CT30563

Dora's Pale scrolls

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Dora runs the kiln at the garden city of Petalbrook. Today the books show a list of scrolls, and the numbers must be worked out before sundown. 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 <= 2004; 0 <= s < e <= 10^9.

Example 1:

Input: 1670 105058 105136 408431055 408431140 485260816 485260824 90933603 90933677 569842797 569842877 598864618 598864619 715675008 715675054 663098450 663098535 434154580 434154581 455291627 455291641 157106050 157106123 661839842 661839937 636816516 636816593 144350404 144350504 874324439 874324494 793972906 793972953 432544555 432544595 806915443 806915477 54202292 54202384 664729369 664729456 322898656 322898681 308383540 308383598 990483153 990483229 882602574 882602620 391788227 391788246 324451230 324451252 264436019 264436118 272611563 272611606 953421461 953421470 65921210 65921294 697595298 697595337 228880777 228880856 491821318 491821397 592014530 592014603 882716934 882716976 473183419 473183498 429783716 429783753 697168813 697168905 191167491 191167586 593680554 593680604 8506428…
Output: 1

Example 2:

Input: 1593 842380940 842381007 121247454 121247457 537152574 537152575 568959164 568959260 54548813 54548833 717647480 717647562 721613161 721613190 678699985 678700002 9177863 9177869 426233228 426233291 938050677 938050691 917313001 917313063 621082417 621082486 351866844 351866890 678547701 678547733 11286899 11286965 305405045 305405110 405768892 405768988 20501954 20501972 129487701 129487777 781034529 781034567 323071762 323071785 282820671 282820685 557422922 557422959 498932998 498933031 502329869 502329920 928237476 928237568 67724003 67724027 264723616 264723632 76754210 76754303 624475488 624475489 922297111 922297146 198965515 198965560 433768491 433768579 53703981 53704062 401052213 401052292 24239897 24239946 89323413 89323478 159579883 159579912 434936413 434936489 343253666 34325…
Output: 1

Example 3:

Input: 1263 135677293 135677339 330286568 330286618 238394824 238394842 573534008 573534036 643685520 643685564 79945995 79946042 414194563 414194593 981638116 981638143 287439921 287439957 45496837 45496860 344172511 344172589 286721731 286721772 896164721 896164782 407158196 407158211 126902272 126902372 922840009 922840109 779934920 779935007 136926344 136926377 767978328 767978426 367571315 367571351 709091856 709091878 946657310 946657351 341075058 341075060 698347522 698347566 868693093 868693177 736533584 736533588 267614202 267614206 410230378 410230402 62530046 62530082 188797298 188797381 253355680 253355776 855819935 855820033 471449615 471449688 51956220 51956232 352527790 352527884 727928537 727928593 1439366 1439376 724062147 724062174 34602596 34602619 879917648 879917695 602127493…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Dora's Pale scrolls - MEDIUM Coding Problem | CodeTikki