CT31053

The Brass windows of Freya

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Before the gates of the old quarter of Brasshaven close for winter, Freya must finish the windows ledger - one figure at a time. 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 <= 1849; 0 <= s < e <= 10^9.

Example 1:

Input: 1715 100722290 100722301 436070166 436070244 118440443 118440475 433449097 433449161 952764832 952764835 70644503 70644580 370866361 370866445 866413543 866413560 931640259 931640266 693998539 693998567 555040521 555040591 307449530 307449588 786165541 786165607 532606739 532606824 956455579 956455668 108479457 108479543 613897147 613897183 751658811 751658854 710096760 710096860 428255022 428255109 260891600 260891624 280105074 280105087 848411348 848411435 486958479 486958503 556060672 556060751 980087519 980087550 653264262 653264263 285944143 285944167 584534276 584534330 103587746 103587800 689534383 689534414 82408631 82408714 716592946 716592959 195682795 195682812 738437155 738437250 503229859 503229958 299513172 299513182 87008317 87008336 602877438 602877509 182123494 182123499 9…
Output: 1

Example 2:

Input: 1138 495816239 495816318 931900406 931900423 466655925 466655969 237168517 237168585 867295580 867295628 983127171 983127253 939356411 939356471 521560094 521560152 552338073 552338123 688357796 688357879 508220154 508220243 82160773 82160799 743686487 743686508 963654079 963654116 738496919 738496926 147955444 147955538 250790946 250791009 569041166 569041173 598461116 598461131 426213692 426213775 960885265 960885361 520828117 520828164 878125773 878125776 991899296 991899314 866004633 866004661 717807802 717807894 855170109 855170131 254854988 254855002 761917636 761917681 688102385 688102461 108373796 108373801 409821276 409821346 636152020 636152038 833844720 833844741 903034206 903034207 160222289 160222330 164946598 164946679 181327268 181327312 586786844 586786871 82786583 82786661…
Output: 2

Example 3:

Input: 798 934237207 934237255 135487133 135487231 336191962 336192050 238827125 238827175 888903570 888903625 40633048 40633106 34479798 34479848 472568026 472568091 348707204 348707265 839518809 839518817 38273120 38273174 285870147 285870153 489038541 489038582 70228452 70228513 656133611 656133686 622798873 622798899 972825433 972825488 674361210 674361224 470596768 470596789 529246297 529246386 704286099 704286156 789414156 789414165 842849393 842849416 819093147 819093211 370162135 370162138 312377540 312377574 57252449 57252472 717559956 717560048 582159192 582159200 297735074 297735126 827533634 827533653 880100250 880100263 922623773 922623833 39266087 39266134 134403252 134403341 181219524 181219597 603386586 603386628 84842750 84842832 18683471 18683557 73984296 73984342 13114151 13114…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Brass windows of Freya - MEDIUM Coding Problem | CodeTikki