CT31491

Qadir's Ledger of ribbons

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

At the ribbon falls of Cascade Vale, Qadir 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 <= 1262; 0 <= s < e <= 10^9.

Example 1:

Input: 1211 584734550 584734619 981599429 981599432 868957851 868957878 39928342 39928386 139765565 139765598 831962112 831962175 586705290 586705319 764942673 764942746 573887843 573887875 555251338 555251391 764252246 764252331 146673033 146673059 569666867 569666906 770425867 770425939 469025940 469025964 366208114 366208195 811780778 811780853 843153802 843153864 744953490 744953540 348289360 348289460 862492684 862492780 794618011 794618035 397107303 397107326 167726378 167726399 563916591 563916626 506047031 506047059 352487596 352487640 209586171 209586235 973893033 973893124 893896530 893896574 670106720 670106787 753311933 753311962 843534157 843534207 730293211 730293273 931287981 931288070 406281549 406281647 111052937 111053031 113407526 113407582 622172003 622172038 884441909 8844419…
Output: 2

Example 2:

Input: 774 328185175 328185178 59264091 59264137 396520527 396520571 578752342 578752408 734322068 734322141 687201272 687201279 353934442 353934493 726274088 726274128 476429782 476429878 592781597 592781614 670146249 670146275 858560758 858560764 71617979 71617996 405355839 405355876 738033952 738034047 883044285 883044384 152241722 152241799 457500587 457500605 917640244 917640325 952842476 952842548 101310263 101310311 523180560 523180590 601172816 601172823 430641051 430641104 108445317 108445380 881452221 881452266 894379803 894379879 334848299 334848338 661990442 661990451 379529225 379529277 629536906 629536929 521598741 521598762 725246583 725246584 491337330 491337388 8989000 8989069 326499795 326499847 504856942 504857024 90565836 90565859 334403629 334403645 924902957 924902973 519472…
Output: 1

Example 3:

Input: 421 829918421 829918446 548117484 548117584 60214490 60214547 66391749 66391830 91821737 91821778 269513187 269513286 325360251 325360306 291783523 291783621 258004951 258005017 923878269 923878368 926836422 926836511 501727374 501727388 503829738 503829796 238057859 238057889 299696360 299696388 160748697 160748712 618581976 618581994 670631014 670631067 98212817 98212872 129793716 129793797 121610638 121610706 409813730 409813785 494128509 494128568 425701229 425701301 843179692 843179727 307313079 307313149 727478517 727478606 882639493 882639522 757343560 757343657 361211744 361211776 690099241 690099252 645308147 645308234 947723258 947723322 39728305 39728310 46696701 46696715 733812348 733812441 882325470 882325490 715167274 715167321 577489491 577489537 760142653 760142717 84280162…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.