CT41788

Last ribbons of Theo

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the lantern lake of Firefly Mere, someone must secure the caravan contract. This year the task falls to Theo, armed only with the ribbons register. 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 <= 2416; 0 <= s < e <= 10^9.

Example 1:

Input: 2113 701729596 701729674 90379482 90379569 740906224 740906263 111552736 111552787 816019089 816019139 455545574 455545614 23458902 23458929 186856017 186856111 556557644 556557709 755612365 755612422 407667256 407667273 541021746 541021783 216296357 216296432 581351358 581351414 673382913 673383003 220235629 220235654 918363414 918363469 387600700 387600782 633012774 633012858 410894084 410894176 710563245 710563280 121225491 121225556 152359702 152359730 424713488 424713514 305145914 305145999 959311490 959311541 741293879 741293957 523853256 523853325 119739265 119739334 635709969 635710066 827838534 827838556 246285630 246285727 656808189 656808194 131913084 131913176 308515770 308515781 398816174 398816227 675582265 675582296 469287980 469288041 491485541 491485577 578953174 578953228…
Output: 1

Example 2:

Input: 1923 617840222 617840228 144430826 144430921 330746627 330746648 698102914 698103012 181504531 181504547 914350227 914350237 448905703 448905707 820986710 820986785 478971056 478971062 771415817 771415876 93710741 93710836 930631391 930631397 179690302 179690380 417170360 417170399 670492411 670492457 427638471 427638552 121111688 121111753 5127568 5127649 247050555 247050639 718623952 718624038 176190238 176190302 187786097 187786140 28941449 28941493 872824880 872824889 805215257 805215307 852720891 852720942 198514269 198514271 26253980 26254036 119659597 119659620 520155291 520155379 720260554 720260608 906899632 906899684 612315655 612315718 336120653 336120674 941854532 941854600 885675534 885675583 806678895 806678906 984805261 984805361 616973987 616973996 234680667 234680696 42591…
Output: 1

Example 3:

Input: 876 968323331 968323377 295744242 295744341 667822417 667822430 72890776 72890814 112367645 112367661 951900696 951900770 140237672 140237753 549386987 549387039 426519263 426519321 13212038 13212059 469021174 469021179 128219967 128220067 682079026 682079033 23040452 23040518 531955019 531955067 767275206 767275220 78590491 78590501 1636549 1636582 21092714 21092754 775254574 775254605 703420568 703420633 988469950 988469954 98486917 98486943 928001124 928001206 948804202 948804260 547813183 547813271 69518363 69518369 909709257 909709298 126504602 126504661 272937049 272937080 528441646 528441687 163630792 163630877 33263795 33263824 558953937 558954035 440484506 440484536 147545916 147545961 342149663 342149710 582131123 582131219 933227740 933227828 456875331 456875386 101304892 101304…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Last ribbons of Theo - MEDIUM Coding Problem | CodeTikki