CT50030

The Busy Hall at Gearford

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the clockwork quarter of Gearford opens only for a perfect tally of panels. Fletcher means to find out. 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 <= 2111; 0 <= s < e <= 10^9.

Example 1:

Input: 188 862780608 862780690 893485361 893485450 516520529 516520603 191479944 191479985 920075993 920076045 124128528 124128596 47218177 47218270 359813233 359813268 611388120 611388215 746103654 746103729 485617932 485618017 200939351 200939387 159005760 159005801 879836438 879836449 921167167 921167172 508357729 508357817 283309310 283309337 702009096 702009180 688189972 688190062 350559245 350559333 411208381 411208459 362570620 362570644 19422893 19422975 100375222 100375255 444155069 444155145 717453752 717453814 914637945 914638011 685471652 685471738 485807639 485807718 521536718 521536781 794366645 794366688 544068791 544068891 79573167 79573191 711056544 711056603 511030386 511030398 842382082 842382085 534406422 534406520 179595966 179596029 80119398 80119431 906924604 906924657 7233…
Output: 1

Example 2:

Input: 1511 733307095 733307157 844603289 844603370 403057279 403057285 957054045 957054111 743251762 743251826 912951726 912951779 615948969 615949030 868044570 868044633 643984198 643984283 921767231 921767234 505263053 505263151 22873712 22873746 778537549 778537581 665958800 665958808 239147037 239147129 225587405 225587503 196442852 196442905 898945445 898945453 402146334 402146410 446215793 446215865 130901245 130901253 650993446 650993472 398771392 398771462 467944860 467944935 962955955 962956012 37880383 37880450 478346993 478347021 634445651 634445661 710984855 710984888 143702685 143702737 133491391 133491462 809403524 809403557 733419379 733419418 646224599 646224661 293858439 293858514 836154483 836154575 792153479 792153506 147779894 147779933 671662012 671662112 703837851 703837894…
Output: 1

Example 3:

Input: 1814 21952247 21952298 517364115 517364192 800685142 800685187 421949662 421949728 509618616 509618699 816379292 816379328 838429673 838429674 819702239 819702309 89871701 89871710 241867416 241867449 622279893 622279939 695845198 695845277 720341839 720341853 925001073 925001143 608819902 608819962 238821734 238821822 473836698 473836766 214652320 214652372 160463389 160463424 610852018 610852061 689805538 689805585 205212392 205212444 220129247 220129337 220276664 220276745 163742972 163743016 282276375 282276452 635426554 635426562 567392928 567392953 18766161 18766214 864196239 864196253 748591968 748591976 319627700 319627702 107323113 107323211 333163688 333163725 498511181 498511264 659732488 659732538 993133025 993133038 80241374 80241441 892949628 892949715 284205686 284205759 788…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Busy Hall at Gearford - MEDIUM Coding Problem | CodeTikki