CT45027

Asha's Busy Hall Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the ivy courts of Vineward, Asha studies rows of scrolls entries. One clean number will settle the guild's oldest argument. 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 <= 2697; 0 <= s < e <= 10^9.

Example 1:

Input: 2346 96481853 96481906 968385985 968386054 928438642 928438697 691236511 691236572 125589181 125589266 440776555 440776582 632510891 632510916 319223707 319223717 905972986 905973020 669597960 669597968 900391422 900391459 516365990 516366057 844084944 844084993 647022604 647022650 487613151 487613185 286596869 286596959 789516870 789516919 216836135 216836168 701280298 701280313 107786915 107787009 689795069 689795112 441711061 441711104 14945881 14945909 326362809 326362872 529397411 529397478 632608308 632608380 802684234 802684333 666890443 666890487 207319376 207319406 885728534 885728560 200350255 200350313 63629851 63629925 415139917 415139962 826159499 826159537 255454508 255454524 473835446 473835463 90266970 90267037 35485277 35485279 35691959 35692058 354636384 354636464 1982808…
Output: 1

Example 2:

Input: 1428 258583535 258583593 343144689 343144780 176789156 176789230 713864872 713864955 670633009 670633078 371687277 371687338 383866616 383866710 510756839 510756896 291663697 291663756 651469433 651469441 593716503 593716554 718924556 718924636 798538930 798539027 563190135 563190149 307060787 307060790 892819509 892819524 427209966 427210007 648084363 648084409 246512117 246512200 648745143 648745220 416955640 416955706 748427256 748427295 614097308 614097320 799542802 799542900 789265718 789265790 588971543 588971564 668219314 668219366 413350571 413350596 550817124 550817179 98690209 98690245 176670313 176670384 858735345 858735418 377784647 377784654 301250023 301250077 457011363 457011424 758540297 758540386 230072009 230072096 174259537 174259591 772025521 772025565 493757235 4937572…
Output: 1

Example 3:

Input: 2267 687882071 687882111 756680109 756680119 630387850 630387919 99329654 99329683 651213999 651214042 276686758 276686834 306213426 306213459 768022831 768022900 329058278 329058291 199123309 199123357 833670230 833670307 393187187 393187215 977939255 977939303 655564684 655564699 735256004 735256029 452124503 452124568 523718556 523718633 724703371 724703429 691016598 691016663 776026305 776026374 814443330 814443359 22246334 22246367 297970279 297970282 238929252 238929284 37359306 37359308 383295496 383295583 851539184 851539229 796771329 796771419 763264330 763264358 672865356 672865366 884204702 884204741 988793458 988793553 75451834 75451865 351402363 351402421 337688677 337688767 418617163 418617217 707282965 707283029 163130916 163130998 916407707 916407780 540223668 540223739 940…
Output: 2

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Asha's Busy Hall Ledger - MEDIUM Coding Problem | CodeTikki