CT41533

The Busy Hall at Willowford

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Clerk found an old ledger of scrolls in the kiln attic at the river town of Willowford. The margin notes pose a precise question. 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 <= 2098; 0 <= s < e <= 10^9.

Example 1:

Input: 1434 651339942 651340020 733159977 733160051 734885781 734885880 760301491 760301533 977976314 977976395 669260162 669260259 642434961 642435001 568645554 568645588 6780113 6780185 397189825 397189911 293587742 293587811 374381040 374381120 805304211 805304281 712129747 712129790 298215784 298215827 668083705 668083805 548948976 548949061 915655257 915655343 282781905 282781987 797428653 797428752 53976647 53976727 402884983 402885006 491160973 491161018 737062367 737062380 720504600 720504609 901692089 901692189 983148223 983148281 357872742 357872796 76198434 76198465 51970186 51970273 976398699 976398702 467358033 467358074 661226996 661227068 758303615 758303668 647049595 647049669 93761610 93761675 951262166 951262206 298289906 298289927 373701121 373701129 721151852 721151869 2547980…
Output: 1

Example 2:

Input: 1858 32615835 32615861 483752104 483752124 575822585 575822680 897638994 897639030 350334455 350334482 588561119 588561189 894683776 894683837 245815063 245815074 855982153 855982212 159897518 159897578 613086871 613086950 594067318 594067329 707677491 707677537 259521669 259521734 907465135 907465235 319832819 319832913 72336032 72336064 837407555 837407654 162482617 162482624 524042021 524042093 56820783 56820852 86209284 86209354 473017348 473017364 120733629 120733651 867624253 867624259 9127634 9127652 25250475 25250560 540456300 540456319 640205005 640205033 682562318 682562341 195085987 195086071 389901286 389901312 443552357 443552442 706502674 706502726 796226511 796226595 819981077 819981151 149961539 149961565 867097502 867097581 197021967 197021986 760479907 760479925 624299881…
Output: 1

Example 3:

Input: 450 671074090 671074141 770434501 770434511 396795970 396796046 794461841 794461892 427056698 427056785 341401888 341401926 6279662 6279684 624683067 624683156 637154045 637154092 206351200 206351260 537200978 537201068 149415690 149415787 648839062 648839128 695082838 695082902 63463455 63463456 165393298 165393387 208886394 208886409 743356999 743357025 614110571 614110653 478800356 478800371 848728338 848728372 613328994 613329036 305490891 305490979 588952516 588952604 483417020 483417060 310562893 310562914 985045446 985045539 796744893 796744958 748045339 748045361 441200316 441200319 90394208 90394254 671659646 671659708 537717000 537717067 959369111 959369152 163731397 163731484 239648357 239648433 887940922 887940928 247035191 247035265 767995538 767995591 260788424 260788469 8248…
Output: 1

Constraints:

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

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