CT38926

Xavi and the Umber scrolls

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the snowberry thicket of Winterholt; Xavi weighs the day's scrolls manifests and starts the calculations. 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 <= 2589; 0 <= s < e <= 10^9.

Example 1:

Input: 1178 376865212 376865298 141430757 141430850 984563357 984563411 649042723 649042785 235324017 235324068 549910726 549910734 23192018 23192093 8319605 8319610 722991860 722991917 820391795 820391887 971978000 971978026 887173739 887173772 462378558 462378576 91678266 91678297 593711214 593711239 454155895 454155927 136416238 136416302 34458374 34458391 894656268 894656342 152341577 152341586 967823329 967823360 228731772 228731867 316684564 316684583 148106046 148106053 188012974 188013000 284961887 284961921 633252495 633252564 938979177 938979233 7730699 7730775 628850988 628851034 349960659 349960744 504860097 504860145 687321668 687321727 567916616 567916625 941955703 941955759 572131667 572131697 253513997 253514000 928941990 928942072 642053321 642053394 111415415 111415485 363905234…
Output: 1

Example 2:

Input: 861 299711933 299711937 955673266 955673288 146793050 146793076 997303882 997303915 741936406 741936491 601145477 601145518 912612167 912612239 362384122 362384221 557561916 557561935 692577000 692577058 266884561 266884626 578788636 578788720 666944837 666944889 933130265 933130302 405620823 405620912 936523664 936523694 91235733 91235775 450127068 450127096 413233582 413233662 715568756 715568786 667776451 667776484 210564122 210564144 655606795 655606853 309697545 309697577 767462754 767462781 908820135 908820220 489866459 489866544 328715157 328715252 809950772 809950773 178002235 178002306 63680334 63680345 438333703 438333743 239357075 239357093 266321242 266321258 308453298 308453307 998890694 998890708 629526077 629526118 658966567 658966593 604531835 604531871 430101765 430101789 …
Output: 1

Example 3:

Input: 426 468736179 468736274 150695860 150695896 458865722 458865742 674235282 674235337 268456124 268456156 193583931 193583965 522331858 522331901 956358685 956358718 905883441 905883469 435383234 435383330 514924238 514924307 38698142 38698145 152936874 152936968 963729969 963729980 397629936 397629959 909527123 909527210 261094421 261094503 596501099 596501199 591450610 591450658 78964050 78964127 111216443 111216541 399386227 399386275 771198631 771198707 27013415 27013512 66393066 66393154 940913480 940913548 838673459 838673557 270783847 270783934 468819555 468819598 557113156 557113246 268352247 268352304 125939234 125939286 842833716 842833782 370166256 370166344 920793772 920793834 765248310 765248316 618802793 618802825 634650692 634650703 436842680 436842704 590956693 590956708 2189…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Xavi and the Umber scrolls - MEDIUM Coding Problem | CodeTikki