CT33755

The Ember scrolls of Cressida

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The surveyor Cressida has been asked to prepare the expedition manifest. On the desk lies a long table of scrolls readings. 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 <= 1655; 0 <= s < e <= 10^9.

Example 1:

Input: 890 773934272 773934365 419307209 419307233 608936637 608936733 768379369 768379420 589844406 589844412 917083726 917083730 585677489 585677499 127622355 127622437 52551111 52551153 533627546 533627608 855320028 855320052 716298786 716298830 524879666 524879757 464232143 464232202 252488692 252488727 101948435 101948497 383695061 383695080 784551876 784551884 683096922 683096971 27785177 27785191 92214127 92214154 715031482 715031484 103763963 103764010 931192542 931192591 612058313 612058400 711592961 711593050 460863516 460863613 375879382 375879421 75951919 75951942 349986269 349986277 588362948 588362949 601346922 601346937 753980282 753980290 84803869 84803939 853321363 853321424 924336191 924336254 202715196 202715202 234304711 234304757 543261543 543261559 279982074 279982114 925537…
Output: 1

Example 2:

Input: 905 341401436 341401512 834591174 834591184 14341212 14341306 494755313 494755402 284130899 284130979 87001237 87001245 556713841 556713880 999013416 999013460 448811451 448811485 299028262 299028306 772568144 772568203 358654062 358654094 14477582 14477597 338911933 338911978 428079623 428079657 305290834 305290915 641908636 641908727 63534439 63534448 470661361 470661441 422817879 422817933 955361748 955361848 914477726 914477781 893524581 893524669 886606711 886606722 398898409 398898417 665908877 665908883 129325729 129325782 696422918 696423003 748179802 748179829 635408474 635408479 284758716 284758747 44160224 44160310 616071054 616071067 771041442 771041497 904334250 904334308 267532396 267532458 806644730 806644752 555191454 555191457 449733828 449733914 502376435 502376487 490325…
Output: 1

Example 3:

Input: 1376 281195685 281195780 639185514 639185604 77054029 77054063 931249299 931249376 615710024 615710036 107777541 107777566 69230465 69230466 895562892 895562903 798898906 798899001 351872937 351872991 533378813 533378873 405989814 405989907 816381610 816381668 526245479 526245492 432207278 432207299 235063760 235063830 585271049 585271146 415985617 415985676 4559303 4559349 364980762 364980804 440891402 440891466 899344940 899345035 923218854 923218951 760942751 760942809 661482473 661482525 928554897 928554949 793945784 793945815 524815621 524815635 414908760 414908833 984912723 984912813 616130688 616130717 791291614 791291653 734681317 734681348 874684944 874685040 219969632 219969633 92072446 92072494 337808639 337808726 259055035 259055036 457251909 457251947 964195532 964195602 71079…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Ember scrolls of Cressida - MEDIUM Coding Problem | CodeTikki