CT40551

Xavi's Lunar Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Xavi found an old ledger of panels in the granary attic at the tundra station of Whitesnow. The margin notes pose a precise question. 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 <= 1316; 0 <= s < e <= 10^9.

Example 1:

Input: 688 571492136 571492232 823613849 823613862 210903395 210903488 522867853 522867935 68458617 68458705 859137036 859137052 257458023 257458040 208514716 208514747 712767021 712767100 643542972 643542986 813885491 813885543 531657100 531657142 431903484 431903522 162988122 162988198 124054320 124054416 567811637 567811684 951922463 951922523 986388147 986388202 477657160 477657250 431294653 431294717 565641554 565641559 345121701 345121743 1949734 1949806 391341830 391341833 179044723 179044758 368482613 368482670 746851529 746851588 140055837 140055851 989819655 989819685 623020455 623020458 763247267 763247357 332555504 332555524 637348870 637348918 502459876 502459939 555448226 555448323 716823560 716823566 398565272 398565304 364914622 364914653 38265423 38265435 712482616 712482642 7739…
Output: 1

Example 2:

Input: 802 837076355 837076432 120664476 120664495 5276537 5276613 61328089 61328154 70528178 70528229 972029833 972029914 893240162 893240184 696099311 696099375 962081193 962081227 283175432 283175494 267245567 267245597 430371420 430371444 170565489 170565531 297992698 297992726 845362870 845362932 718939021 718939059 615378653 615378687 872735932 872735967 369539814 369539883 732899343 732899393 198831864 198831895 25791319 25791327 783720478 783720567 964012196 964012248 672128564 672128584 211818738 211818805 482031299 482031343 862232865 862232887 742945112 742945199 805383908 805383994 579846754 579846810 143043666 143043674 831615472 831615560 249314225 249314239 398159301 398159390 617030098 617030172 266385420 266385474 492962292 492962313 12819371 12819441 343571577 343571581 41868733…
Output: 1

Example 3:

Input: 29 627301487 627301492 17659485 17659547 879851976 879852036 262338747 262338833 216144099 216144121 997313899 997313902 166112948 166113046 859659353 859659418 242007926 242007950 327061394 327061425 149609514 149609553 635808268 635808301 499077875 499077964 433135483 433135547 965361669 965361740 92186215 92186250 165723735 165723760 312465434 312465458 670305982 670306017 760938347 760938418 623732146 623732233 384103689 384103777 749418602 749418640 489494094 489494119 621706916 621706969 341493727 341493735 207134085 207134126 71665786 71665860 732876960 732877002
Output: 1

Constraints:

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

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