CT37146

Warden's Ledger of scrolls

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Warden runs the brewery at the bamboo terraces of Verdantstep. Today the books show a list of scrolls, and the numbers must be worked out before sundown. 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 <= 2605; 0 <= s < e <= 10^9.

Example 1:

Input: 1428 267855460 267855494 773157541 773157614 41104714 41104805 771807451 771807529 866762644 866762723 934584395 934584456 170278778 170278834 47826173 47826261 72013037 72013085 646478638 646478646 311272046 311272110 806892205 806892278 735465833 735465921 54262838 54262908 8364210 8364266 375314804 375314853 11252057 11252117 455656313 455656316 41240443 41240467 277258640 277258668 639177307 639177335 932895918 932896017 701900719 701900758 973939936 973939984 984740601 984740608 945586433 945586505 914601874 914601968 954798777 954798849 552623900 552623954 525038689 525038766 141038316 141038336 340464009 340464056 522675565 522675614 74867524 74867555 114135279 114135326 211047724 211047787 858752737 858752751 828864352 828864447 493111392 493111452 692293501 692293576 243459997 243…
Output: 1

Example 2:

Input: 450 621746311 621746338 207780747 207780826 340050467 340050560 89815696 89815792 399868510 399868592 987538906 987538977 757864434 757864461 852591361 852591377 409877128 409877219 817067941 817068008 817024980 817025072 228721578 228721638 41673376 41673435 789766597 789766630 224798396 224798400 799844480 799844495 271904284 271904332 584589868 584589908 387407430 387407506 288305478 288305495 681053438 681053481 471890287 471890325 476503985 476504074 266319380 266319444 67816110 67816114 68990663 68990719 275863840 275863903 908945611 908945687 95374749 95374804 925629811 925629870 808347977 808347996 690302740 690302808 550612981 550613035 329581122 329581151 621405154 621405175 903982814 903982870 180504782 180504810 537013611 537013671 57216022 57216064 245553821 245553841 29883437…
Output: 1

Example 3:

Input: 2519 177153708 177153781 126093446 126093537 603053769 603053813 141128248 141128314 739346938 739347026 711906949 711906984 702279236 702279242 811977251 811977349 255812442 255812541 510812146 510812234 64565085 64565159 380798548 380798602 848129987 848130030 642088577 642088665 665623003 665623098 566692374 566692427 919283719 919283762 308984351 308984399 340651599 340651675 41902398 41902447 527280983 527281031 895912542 895912566 68564739 68564756 868013358 868013369 361590998 361591061 886461757 886461779 13314559 13314572 165159274 165159318 938043548 938043640 3188839 3188858 838040303 838040368 353928715 353928801 301824334 301824376 885487947 885487980 869787271 869787340 649551226 649551258 517382151 517382173 957969702 957969743 335700935 335700987 436322572 436322650 8093797…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Warden's Ledger of scrolls - MEDIUM Coding Problem | CodeTikki