CT44793

Theron's Busy Hall Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the garden city of Petalbrook close for winter, Theron must finish the ribbons ledger - one figure at a time. 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 <= 1382; 0 <= s < e <= 10^9.

Example 1:

Input: 1267 708884069 708884093 638941255 638941307 3082724 3082785 557266681 557266726 522113458 522113554 135410888 135410895 114853281 114853296 442220597 442220665 660131331 660131352 329919479 329919485 238841804 238841897 730359460 730359521 890075139 890075153 120001328 120001422 755808226 755808274 842125951 842125956 585890508 585890576 42510346 42510426 795397541 795397630 488019686 488019696 83296013 83296111 14327773 14327774 795084559 795084636 668462263 668462281 364127615 364127678 891908792 891908878 277339565 277339647 723591181 723591212 356234950 356234963 147159520 147159617 106808843 106808846 205846363 205846423 372260168 372260263 71873737 71873767 874588118 874588215 385651436 385651442 938774084 938774157 159415984 159415992 427420276 427420307 123905574 123905659 3649494…
Output: 1

Example 2:

Input: 780 342147477 342147571 513810181 513810188 338867882 338867947 149777929 149777979 31767216 31767257 122111301 122111311 23557708 23557717 411793625 411793678 516396879 516396942 217419223 217419258 352222997 352223078 926810139 926810224 1299818 1299823 941030964 941031054 616835095 616835164 95167811 95167844 500439319 500439373 988516896 988516926 121890781 121890871 672011361 672011371 361875708 361875735 783073989 783074003 113800929 113801020 179657781 179657784 74311394 74311476 558542457 558542505 254350042 254350048 593656312 593656399 411332755 411332850 560243829 560243834 83050891 83050914 714401970 714401987 394083367 394083421 39928092 39928190 131412478 131412530 305650288 305650320 644533348 644533444 582382797 582382878 287167732 287167785 989295442 989295507 427987809 42…
Output: 1

Example 3:

Input: 347 598345133 598345217 787062806 787062825 660469143 660469150 209070700 209070795 501491682 501491724 596643767 596643860 902073253 902073353 616870699 616870732 998419945 998420033 290803211 290803262 476095013 476095018 277804356 277804432 853989991 853990077 729157731 729157821 560655025 560655051 194117334 194117413 751325386 751325426 474863990 474864065 522239956 522240045 121820406 121820423 452370269 452370368 33695839 33695901 776481765 776481782 663011551 663011630 379849247 379849280 756620157 756620237 751460973 751461064 319073316 319073333 110127655 110127680 571853156 571853248 572338084 572338121 849858165 849858249 817541428 817541500 556105788 556105849 603111234 603111316 244960991 244961002 875589807 875589907 312462906 312462919 603057178 603057181 598024056 59802411…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Theron's Busy Hall Ledger - MEDIUM Coding Problem | CodeTikki