CT49047

Last windows of Ivan

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the orchid house of Bloomglass, Ivan the reckoner keeps careful count of the windows. Restore an old family record, every figure matters. 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 <= 2240; 0 <= s < e <= 10^9.

Example 1:

Input: 532 632908561 632908601 107632907 107632971 634457694 634457771 749071509 749071515 215268629 215268650 487019294 487019301 111369030 111369098 303738805 303738865 752850979 752851074 154405798 154405876 876151016 876151078 781599859 781599924 2407077 2407136 882899792 882899870 193064593 193064637 444906914 444906923 99276534 99276541 508314157 508314242 710011052 710011120 160462447 160462460 922937100 922937170 457624882 457624962 946895649 946895680 15635296 15635352 915461935 915462022 418638750 418638777 262703679 262703690 33955507 33955529 782153863 782153929 125415587 125415656 204888765 204888815 570207587 570207627 814252346 814252440 151095446 151095494 92832248 92832327 553469539 553469565 351455694 351455729 849040151 849040192 158394255 158394344 2519064 2519111 309614238 30…
Output: 1

Example 2:

Input: 247 707462961 707463042 262889111 262889180 893999596 893999620 797951341 797951354 969880157 969880227 448487009 448487040 229853561 229853581 363870694 363870778 975052989 975053052 555793490 555793544 271651286 271651357 139654285 139654299 460812465 460812554 174003610 174003705 149199598 149199641 279593764 279593804 380422410 380422414 864583122 864583193 460895334 460895389 926088144 926088197 705086023 705086113 524358254 524358325 241730038 241730122 506066591 506066652 44713396 44713469 229395759 229395827 125181487 125181576 48441694 48441758 745572980 745573015 637663522 637663583 756039511 756039602 543138618 543138643 906501009 906501089 889257953 889257981 15398565 15398567 823970250 823970284 87715372 87715437 60061123 60061181 537995581 537995597 358827447 358827503 225430…
Output: 1

Example 3:

Input: 1158 106733663 106733717 486318017 486318043 990752433 990752466 182548002 182548078 870489234 870489270 328047481 328047562 419486308 419486315 768743068 768743087 66811950 66812047 102162138 102162159 853921263 853921357 727149262 727149313 631466195 631466245 191262492 191262588 46167999 46168096 264940495 264940579 704920409 704920445 168328833 168328851 17125239 17125262 966634892 966634908 311390506 311390602 604051190 604051233 695874808 695874840 678513370 678513434 913696866 913696957 858361720 858361759 365845465 365845502 408364614 408364684 251441392 251441480 161781502 161781566 641712984 641713045 213837556 213837591 902496828 902496910 823853438 823853443 982749815 982749859 512682735 512682787 831008668 831008759 685053228 685053301 354412414 354412451 157311469 157311565 1…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.