CT29311

Archivist Counts the ribbons

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

It is audit day at the island market of Coralcove. Archivist spreads the ribbons records across the table and picks up a sharp pencil. 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 <= 1499; 0 <= s < e <= 10^9.

Example 1:

Input: 630 654569631 654569685 695583796 695583842 824866495 824866532 837185556 837185648 294661751 294661808 849430797 849430839 990647105 990647192 267335021 267335042 656484196 656484254 313667374 313667380 612790732 612790832 713805160 713805217 241273512 241273536 68514332 68514395 835773455 835773516 62801189 62801221 48618577 48618633 843143984 843143988 843147805 843147884 421245811 421245826 405788315 405788339 710826915 710826957 71760312 71760379 612745624 612745633 269553896 269553967 271504567 271504605 658872428 658872459 70895092 70895117 90881981 90881997 225685317 225685415 646785243 646785277 993751784 993751873 469886586 469886661 242545926 242545966 988008049 988008137 990044906 990044922 32153220 32153268 472938086 472938089 126442124 126442194 163718561 163718617 427117803 …
Output: 1

Example 2:

Input: 478 822242931 822242982 648682419 648682453 587445035 587445129 519766716 519766775 124550968 124551056 281380507 281380550 653804068 653804109 41266764 41266798 49547550 49547611 713795362 713795410 406044344 406044363 17997124 17997192 831099053 831099134 762058663 762058729 517690500 517690537 853986715 853986812 2238789 2238882 230382017 230382101 794176238 794176246 816478751 816478798 978061613 978061660 909323968 909323970 96243215 96243300 316955651 316955737 270184109 270184153 182539830 182539866 965471563 965471614 290563008 290563082 506678507 506678515 425148608 425148653 45759520 45759559 856496678 856496758 541694312 541694375 574255780 574255856 967333964 967333970 794963338 794963356 204470623 204470700 757854619 757854666 74261210 74261255 45041993 45042069 278680867 2786…
Output: 1

Example 3:

Input: 834 96709388 96709488 81243831 81243900 282792609 282792675 316437384 316437450 69928416 69928479 110691640 110691720 483034084 483034128 460356604 460356673 500687439 500687507 568291688 568291785 887419476 887419507 13957752 13957833 272062893 272062935 890293667 890293698 658583896 658583971 846460656 846460694 468061794 468061880 684677160 684677248 815647872 815647960 273230514 273230553 497843588 497843632 105016771 105016781 279004042 279004126 693592264 693592294 943591400 943591465 472513964 472514063 616991775 616991838 770804723 770804743 365977629 365977687 716979410 716979414 826628298 826628312 552438162 552438234 849091193 849091249 815330300 815330371 943835436 943835490 603119636 603119702 91008900 91008958 51925469 51925556 549976924 549976965 705801402 705801418 29742086…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Archivist Counts the ribbons - MEDIUM Coding Problem | CodeTikki