CT40834

Milo's Timeworn Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the garden city of Petalbrook with crates of windows, and Milo the chronicler 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 <= 2222; 0 <= s < e <= 10^9.

Example 1:

Input: 853 674243384 674243386 339904220 339904301 513025107 513025167 221377702 221377772 832746223 832746305 639463786 639463837 694378539 694378633 240866202 240866294 117690895 117690942 999536879 999536978 687575564 687575569 738411746 738411802 756009781 756009835 79308913 79308967 948530031 948530070 466921591 466921670 735196765 735196795 657902888 657902971 271852207 271852291 166012238 166012327 391573806 391573881 4487107 4487193 937282370 937282439 201444277 201444374 454393153 454393213 225103951 225104041 311687760 311687811 382948994 382949036 615425541 615425610 885361094 885361169 602884314 602884368 427088527 427088622 711252108 711252138 748960525 748960572 464680731 464680735 964873196 964873237 55920999 55921033 511793838 511793878 167862077 167862097 624008979 624009025 7195…
Output: 1

Example 2:

Input: 1706 779890028 779890118 714719964 714720003 139344343 139344399 847864321 847864419 662895332 662895346 177068892 177068930 672474207 672474273 786198032 786198061 611675543 611675564 27055612 27055669 665386958 665387033 588685896 588685971 45418851 45418911 529304895 529304947 909588893 909588975 713146450 713146519 391463488 391463514 576594032 576594036 245018621 245018629 213733402 213733468 546124156 546124186 741389358 741389407 410327334 410327433 237950084 237950122 56510170 56510246 568586915 568586939 452120785 452120814 149792303 149792379 622956424 622956442 322695206 322695277 199459691 199459763 476592550 476592625 686298178 686298267 194090079 194090089 272323643 272323690 646403189 646403224 219308513 219308516 167942751 167942767 449961277 449961351 758816363 758816371 4…
Output: 1

Example 3:

Input: 1695 657718799 657718817 731017761 731017860 366914620 366914690 938928348 938928379 306115587 306115653 792122621 792122662 16256397 16256491 691598995 691599069 565054683 565054780 553729155 553729245 418005423 418005463 380184430 380184486 325625064 325625089 488596515 488596586 800351478 800351527 666381085 666381100 171644218 171644228 492986904 492987000 642221616 642221650 943604329 943604355 326811876 326811882 61402520 61402561 865434488 865434578 295999653 295999750 306079098 306079140 888455345 888455396 876423985 876424045 36406370 36406423 666078304 666078366 394931805 394931839 476007122 476007132 164987874 164987938 680401648 680401721 273347360 273347403 655994259 655994359 482503368 482503449 885047356 885047432 306377139 306377213 227053131 227053195 954318641 954318738 5…
Output: 2

Constraints:

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

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