CT37928

The Busy Hall of the Lunar ribbons

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the railway depot of Cinderline, Manav records each ribbons in a worn leather ledger. The guild wants answers, not guesses. 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 <= 1571; 0 <= s < e <= 10^9.

Example 1:

Input: 1256 866273954 866273964 480841682 480841781 22868863 22868926 399527546 399527564 507315324 507315418 175380653 175380729 24160718 24160817 575619385 575619421 524949053 524949073 33149857 33149907 388875081 388875165 966113157 966113234 536460500 536460571 838725906 838726003 466928855 466928931 163264497 163264542 951800779 951800813 438979521 438979559 534773327 534773425 799082539 799082615 700352687 700352705 277924724 277924771 40368037 40368069 344172194 344172252 616683326 616683414 840227211 840227223 606700306 606700375 449435959 449436059 545125403 545125481 426334760 426334856 75820634 75820674 203152232 203152247 45069101 45069191 637193562 637193649 897928214 897928302 835838959 835838985 713572214 713572251 165338624 165338675 520547742 520547838 293206323 293206393 2716944…
Output: 1

Example 2:

Input: 1029 115196894 115196915 651784687 651784769 550381845 550381889 480074420 480074440 812150702 812150795 703447485 703447491 85046031 85046127 628821563 628821656 654243898 654243986 533555295 533555332 895593648 895593692 122989547 122989550 759637759 759637795 45075559 45075575 651477805 651477898 452743669 452743700 478837568 478837574 405224352 405224369 545799450 545799542 61781203 61781296 93730643 93730661 46862929 46863009 888326401 888326409 388064059 388064121 105309781 105309796 79218186 79218220 604912051 604912115 904820723 904820811 294736515 294736581 250456577 250456641 89202408 89202468 520575317 520575382 824563093 824563115 743519448 743519467 321741455 321741468 16923160 16923232 165998717 165998723 643705766 643705784 588912646 588912723 71791155 71791166 76058084 7605…
Output: 1

Example 3:

Input: 840 216532570 216532653 486408168 486408172 649100329 649100362 317104088 317104163 360379970 360380015 119698474 119698556 903533771 903533837 240924005 240924033 480640295 480640299 633958693 633958768 282112515 282112575 799588483 799588536 394982750 394982800 586973020 586973098 202673772 202673857 539162740 539162792 66629018 66629089 258189061 258189073 285991150 285991204 698136676 698136751 692760986 692761075 465471061 465471094 909587527 909587623 205881061 205881112 974268585 974268671 706916044 706916054 707839457 707839511 108704272 108704283 340853500 340853593 739990494 739990521 333702736 333702779 721095141 721095203 64458356 64458402 779567700 779567717 285801108 285801137 908108366 908108409 139173992 139174038 826602338 826602371 380528739 380528750 274725088 274725108 …
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Busy Hall of the Lunar ribbons - MEDIUM Coding Problem | CodeTikki