CT30909

The Busy Hall Beneath Alabast

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Ranger runs the observatory at the ivory gates of Alabast. 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 <= 1399; 0 <= s < e <= 10^9.

Example 1:

Input: 308 351349896 351349928 287141586 287141648 448689938 448689996 424580360 424580376 529046230 529046320 761345701 761345789 648220750 648220826 862473587 862473629 882619419 882619447 958006035 958006119 507565365 507565367 484634514 484634612 296022 296086 452806959 452806962 375843001 375843062 987957545 987957546 636061171 636061211 88862412 88862427 732847859 732847908 890213177 890213232 352675731 352675791 254677208 254677215 156623296 156623332 753669027 753669079 920853590 920853681 891289804 891289806 368423037 368423091 15485518 15485569 586757435 586757466 744734200 744734223 220324922 220324958 457081276 457081354 19097721 19097727 873218899 873218939 210350526 210350605 920947869 920947948 854512633 854512700 824763736 824763771 92872017 92872083 710818659 710818701 120665801 …
Output: 1

Example 2:

Input: 1091 217707977 217708010 837823014 837823078 255699446 255699503 546692326 546692394 661644842 661644850 615421037 615421113 63834920 63834960 808413675 808413676 889345257 889345318 692367948 692367965 590944749 590944828 330467916 330467946 991341336 991341408 953138474 953138534 437661159 437661165 669019928 669019983 292772036 292772077 541778147 541778226 466370525 466370583 775095980 775096008 83760459 83760524 621555949 621556032 329581818 329581884 992413833 992413908 502444945 502445013 696490443 696490465 733953038 733953057 31058024 31058041 63745857 63745936 107116695 107116764 372222425 372222462 900237840 900237858 943381660 943381748 227942547 227942618 320044135 320044210 260284661 260284664 680989879 680989953 266999314 266999403 185715626 185715726 762887333 762887388 542…
Output: 1

Example 3:

Input: 1032 335637225 335637228 60905653 60905681 430891005 430891010 599195796 599195848 562946544 562946566 711457605 711457703 137076700 137076731 412494943 412495036 251378487 251378516 273140492 273140588 404688177 404688268 338602211 338602284 295900578 295900672 719375615 719375707 67797859 67797932 732394661 732394679 735246534 735246592 553719779 553719798 319214868 319214881 747334978 747335020 566903367 566903449 160931428 160931440 878969932 878969959 422494153 422494189 701274432 701274516 72930048 72930051 922847707 922847743 192387019 192387068 786367867 786367952 197269078 197269165 405576544 405576614 818164553 818164634 977507168 977507189 861681041 861681087 595117928 595117936 167718336 167718357 464729580 464729635 364094371 364094463 100226598 100226646 72163907 72164004 573…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Busy Hall Beneath Alabast - MEDIUM Coding Problem | CodeTikki