CT39936

Marek and the Busy Hall

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the spice bazaar of Saffronia with crates of windows, and Marek the registry keeper must account for every last one. 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 <= 2375; 0 <= s < e <= 10^9.

Example 1:

Input: 195 659164456 659164496 54106716 54106759 350108496 350108515 416598805 416598898 664938507 664938564 116405228 116405239 831531463 831531505 450714297 450714341 531220434 531220458 199795268 199795354 983068804 983068903 354294512 354294544 569956927 569956933 936939735 936939782 624887853 624887942 597274634 597274673 807897976 807898026 360939613 360939707 175439827 175439915 847867480 847867542 12270767 12270778 360209341 360209350 435563885 435563942 690677422 690677424 31476026 31476054 786841498 786841501 423961423 423961447 151618854 151618918 98125586 98125597 436803164 436803186 612574078 612574162 758932063 758932114 731016113 731016123 544365591 544365618 927900050 927900103 940439617 940439706 653672962 653672970 771495760 771495835 617512996 617513048 293381229 293381329 3970…
Output: 1

Example 2:

Input: 1703 213698325 213698415 451046976 451046979 713761756 713761775 179232979 179233043 59136982 59137061 430710265 430710314 525946176 525946205 63545794 63545814 142948572 142948627 839980257 839980269 363497474 363497484 233381091 233381095 32541345 32541378 974972441 974972444 425360643 425360690 712348354 712348399 250013936 250013946 466382929 466382951 788586157 788586211 211346993 211347066 338531101 338531152 679295137 679295199 459465705 459465798 934362707 934362799 835647213 835647230 400319821 400319829 353772018 353772046 263479427 263479525 130069992 130070011 244241040 244241041 138073956 138074024 288888251 288888296 529447081 529447095 350190478 350190532 840847394 840847405 455489289 455489366 810589682 810589748 546470135 546470167 526094260 526094345 383109644 383109715 8…
Output: 1

Example 3:

Input: 1240 699455636 699455718 403915462 403915561 55016236 55016249 399122101 399122106 264922542 264922589 374545868 374545892 458386889 458386987 299860717 299860786 555252187 555252215 137655948 137656037 510637891 510637897 812042208 812042286 65329138 65329174 634604810 634604890 538246281 538246326 128981345 128981378 252485122 252485157 732288572 732288671 449158839 449158879 122513061 122513145 445808932 445809020 668428819 668428881 128637086 128637145 815123986 815124015 936148098 936148115 968230084 968230165 391542459 391542527 32151676 32151743 450018590 450018642 962152471 962152522 694121852 694121944 262443457 262443496 552941937 552942002 955477049 955477114 671917994 671918008 414995238 414995300 910007394 910007479 960840223 960840292 30455569 30455592 412065230 412065330 523…
Output: 2

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Marek and the Busy Hall - MEDIUM Coding Problem | CodeTikki