CT33696

Shepherd's Busy Hall Ledger

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

At the ivy courts of Vineward, Shepherd records each segments in a worn leather ledger. The guild wants answers, not guesses. 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 <= 2438; 0 <= s < e <= 10^9.

Example 1:

Input: 1251 318981055 318981091 809950346 809950349 950365669 950365672 64839313 64839379 413821023 413821072 857773275 857773370 282771746 282771767 76475568 76475586 247052270 247052280 282976016 282976091 739365737 739365833 182952103 182952109 361433048 361433061 29989136 29989197 354427312 354427407 177352983 177353045 630193844 630193917 699488235 699488246 236670428 236670495 937312939 937312990 616901050 616901073 149659724 149659791 758414791 758414878 814436337 814436412 322276601 322276658 685668929 685668933 441695853 441695889 161674498 161674503 895943405 895943411 322689471 322689535 872439423 872439444 780569091 780569158 680470783 680470811 274582088 274582185 10446829 10446922 423840747 423840844 816915134 816915190 337456688 337456743 106027738 106027748 774331106 774331166 396…
Output: 1

Example 2:

Input: 1356 170907450 170907550 871512254 871512290 108807363 108807372 689631980 689631984 396837056 396837060 846542623 846542630 953785811 953785877 490728683 490728747 713326393 713326422 818025739 818025780 629977922 629977969 975072299 975072353 220973602 220973671 313925434 313925506 984008091 984008179 300707223 300707260 809141104 809141139 670175269 670175328 683903516 683903566 452372497 452372505 962157518 962157593 329882157 329882161 754763409 754763489 935916909 935916934 237960414 237960415 422231188 422231257 173319267 173319329 214839700 214839764 432537953 432537965 463719673 463719692 703378926 703379005 967175336 967175368 283621809 283621868 263605465 263605506 955321593 955321628 267092654 267092706 356221719 356221808 581536063 581536105 88316897 88316994 958141154 9581411…
Output: 1

Example 3:

Input: 1196 159859491 159859571 373320641 373320677 656715518 656715578 741593188 741593275 715495924 715496015 154920755 154920797 746944919 746944956 5469538 5469619 659808734 659808793 555009368 555009454 356607613 356607689 959428959 959429044 504095777 504095876 40458954 40458956 631274453 631274544 637390910 637390941 503063365 503063398 343920668 343920730 813567774 813567793 545113161 545113217 442795423 442795426 785759170 785759258 825604558 825604657 276405586 276405659 51466652 51466718 864088782 864088820 893023182 893023207 332372997 332373027 885747326 885747359 177080451 177080462 367548528 367548575 458502011 458502054 696722749 696722843 68095273 68095302 177826880 177826972 30458847 30458925 900667217 900667234 345188650 345188698 171096241 171096304 828809140 828809198 2364765…
Output: 1

Constraints:

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

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