CT56720

Parth and the Silver windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the silver mines of Lodebarrow with crates of windows, and Parth the quartermaster must account for every last one. 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 <= 2404; 0 <= s < e <= 10^9.

Example 1:

Input: 803 804805837 804805855 877997744 877997751 245980844 245980878 998957447 998957489 348143740 348143784 398131887 398131932 903860236 903860242 987231665 987231752 606932950 606932973 896677025 896677067 555313943 555313972 888543565 888543618 253988847 253988896 790744540 790744577 651560660 651560732 897860456 897860529 794381168 794381215 41996022 41996118 858249745 858249747 772233472 772233491 829162267 829162355 553588198 553588199 266051846 266051871 844580069 844580096 561487088 561487113 519172374 519172392 485625233 485625283 106783639 106783659 82766720 82766741 118984621 118984699 925399562 925399603 982853634 982853642 903979505 903979522 808902645 808902677 691742326 691742379 515376134 515376154 845058105 845058153 842788868 842788935 610314219 610314230 943024066 943024124 …
Output: 1

Example 2:

Input: 453 467870513 467870560 115344505 115344537 739102901 739102969 965557581 965557632 556454240 556454310 222986885 222986941 730892119 730892126 777385729 777385789 471195447 471195490 336696490 336696572 472732329 472732422 623355919 623355963 647405153 647405187 892017592 892017613 421141878 421141965 840496059 840496077 56049874 56049959 49169900 49169918 312867794 312867893 969041983 969042076 225157478 225157567 138345905 138345946 805755282 805755290 807253000 807253084 941692137 941692182 979558203 979558206 828190949 828191029 593673461 593673471 261602464 261602552 172713547 172713614 371271163 371271242 882795157 882795208 825244671 825244736 890218062 890218136 312732371 312732421 584262870 584262943 380349416 380349421 48245285 48245332 907811599 907811627 417021329 417021346 37…
Output: 1

Example 3:

Input: 1698 541133992 541133999 195645699 195645707 212410124 212410184 246774916 246775008 935235124 935235156 517414216 517414241 650097129 650097158 659552222 659552234 180869123 180869180 549603507 549603569 50388009 50388069 498309505 498309544 404623055 404623081 516288687 516288758 966333897 966333948 351751485 351751495 557740100 557740131 169845534 169845609 234080207 234080294 344372781 344372798 342718666 342718700 134513047 134513125 713659208 713659288 959284399 959284415 932776361 932776461 777404877 777404885 597003960 597003962 404880140 404880141 33348002 33348018 820193385 820193410 414912947 414912975 121885627 121885658 527245081 527245169 712110767 712110826 679002370 679002379 502091778 502091815 645292266 645292278 261992192 261992289 872990002 872990008 662855613 662855679…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Parth and the Silver windows - MEDIUM Coding Problem | CodeTikki