CT31939

Esha's Ledger of scrolls

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Deep in the valley of Misthollow, Esha studies rows of scrolls entries. One clean number will settle the guild's oldest argument. Task: n crews each guard a half-open interval [s,e). An interval ending at time t does not overlap one starting at t. Print the maximum number overlapping at any instant. Input format: First line: n. Next n lines: s e. Output format: Print the maximum simultaneous overlap. Constraints: 1 <= n <= 1081; 0 <= s < e <= 10^9.

Example 1:

Input: 204 79624509 79624602 618131622 618131689 903034319 903034332 780068698 780068731 262485954 262486016 840503835 840503839 951511517 951511552 412380929 412381005 498561201 498561301 384620684 384620756 119115276 119115315 366551152 366551244 1255695 1255700 504327528 504327626 842505475 842505507 404868436 404868494 507125983 507126069 389995793 389995828 846582257 846582321 560884620 560884636 456744845 456744932 226790805 226790824 17437551 17437645 794602717 794602810 228299467 228299491 533718528 533718604 970558759 970558820 197959829 197959901 359827889 359827892 735214991 735215040 837853262 837853291 96438494 96438574 474414577 474414655 485934328 485934387 570356505 570356555 724350527 724350579 526925555 526925630 521525700 521525763 969748615 969748676 423809410 423809426 356025…
Output: 1

Example 2:

Input: 687 866254288 866254289 993979447 993979462 507261060 507261115 929297171 929297269 382814368 382814425 974597410 974597492 29089165 29089204 452763404 452763444 933931256 933931318 410842024 410842050 76128469 76128511 637981142 637981171 643040941 643040965 25960259 25960285 611634073 611634112 206311196 206311240 256196534 256196633 580287466 580287502 181136496 181136513 468050054 468050059 976123042 976123046 810837026 810837101 710200456 710200475 845497847 845497923 769917828 769917880 478655847 478655920 766218481 766218539 892460092 892460131 785506100 785506195 315192759 315192814 72962120 72962160 939320399 939320460 647240071 647240152 851102443 851102495 818515379 818515468 398169214 398169224 651665477 651665481 785552794 785552833 941270363 941270364 60966268 60966353 662017…
Output: 1

Example 3:

Input: 504 289889568 289889613 632522283 632522336 502025958 502025980 423817073 423817117 43130044 43130096 669553004 669553091 110329475 110329489 857587465 857587502 588822637 588822695 908931631 908931730 159271113 159271210 977810151 977810183 428270971 428271057 718713521 718713527 875518455 875518503 890192578 890192659 33471244 33471265 511931061 511931116 895502959 895503055 313696836 313696839 812850212 812850258 614836734 614836793 849070418 849070492 876472254 876472267 507599978 507600045 221978881 221978956 625778248 625778338 606483190 606483230 423756888 423756988 724109709 724109745 535365927 535366014 554921601 554921679 857875922 857875996 136777728 136777770 720382849 720382897 125433047 125433147 897967617 897967707 982840479 982840555 174357895 174357933 324148488 324148555 …
Output: 1

Constraints:

1 <= n <= 1081; 0 <= s < e <= 10^9.

Loading...
Test Cases:No test cases
No test cases available.
Esha's Ledger of scrolls - MEDIUM Coding Problem | CodeTikki