CT54065

Sailor and the Vermilion segments

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the cliffside roost of Stormrest with crates of segments, and Sailor the store warden 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 <= 2369; 0 <= s < e <= 10^9.

Example 1:

Input: 2210 9898329 9898366 469424690 469424767 816228656 816228696 63609113 63609178 902013016 902013107 823782775 823782807 159099869 159099946 377273456 377273486 414909329 414909421 366695106 366695188 803853748 803853772 109514187 109514257 211578145 211578168 527533204 527533255 380234341 380234369 232087077 232087115 717893904 717893951 614518778 614518858 635052519 635052571 603718374 603718471 124413896 124413918 857435999 857436070 25887825 25887912 942663473 942663496 334072029 334072030 680575100 680575180 948870232 948870233 230207586 230207613 402115026 402115043 984031824 984031905 633638192 633638270 546182610 546182655 326035065 326035092 891471078 891471176 49403421 49403488 212672105 212672179 409259030 409259068 231827971 231828000 108629243 108629301 155147642 155147646 92329…
Output: 1

Example 2:

Input: 127 41169311 41169325 333529345 333529388 468871703 468871803 757179396 757179476 588043068 588043166 936692344 936692363 827391411 827391438 505919850 505919855 770847246 770847255 115282829 115282859 74601121 74601216 503731491 503731536 581379822 581379895 7237361 7237431 405404292 405404310 447972803 447972869 354254392 354254465 879835857 879835862 268191013 268191043 45030321 45030352 732799116 732799132 784177962 784178039 533712864 533712906 677357691 677357775 323351440 323351445 294279223 294279256 195499369 195499440 982282357 982282413 723750237 723750274 850963500 850963590 126074669 126074767 325405347 325405369 897090728 897090828 235544267 235544321 446376489 446376513 345318326 345318363 823888905 823888953 153753771 153753810 868387915 868387974 270801337 270801397 705066…
Output: 1

Example 3:

Input: 2320 298415240 298415340 970331706 970331752 130903172 130903214 35455062 35455121 567550199 567550293 306471770 306471786 406643741 406643768 262429853 262429941 426963850 426963892 766802669 766802685 830384118 830384145 886226259 886226285 191918862 191918922 606083719 606083744 247918485 247918536 895679224 895679240 650387200 650387271 737596966 737596997 785895232 785895238 853526151 853526216 983323320 983323388 915641572 915641667 92666697 92666771 783456089 783456114 239612167 239612169 754868240 754868292 588320268 588320324 912552767 912552862 680965119 680965132 825093501 825093535 241535927 241535990 653973584 653973606 499588990 499589036 563328468 563328536 28001751 28001798 35201963 35202013 219661525 219661618 685930509 685930539 911465142 911465183 251258860 251258919 261…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Sailor and the Vermilion segments - MEDIUM Coding Problem | CodeTikki