CT49934

Miller and the Moonlit windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the beacon hill of Lantern Tor, Miller the surveyor keeps careful count of the windows. Decode the foreman's shorthand notes, every figure matters. 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 <= 1021; 0 <= s < e <= 10^9.

Example 1:

Input: 490 358676108 358676200 620203856 620203910 579136143 579136176 677599857 677599941 876179671 876179672 987725299 987725306 224437132 224437133 979876244 979876324 848424665 848424674 717799258 717799268 324576721 324576747 301264244 301264332 982337934 982338012 216231614 216231647 384849218 384849257 978488580 978488611 199237008 199237018 469655651 469655728 752891860 752891916 806166532 806166630 712513870 712513899 41001163 41001217 157359845 157359917 393262905 393262972 40299499 40299514 448762467 448762499 289400484 289400504 485818999 485819032 153050751 153050785 717651489 717651577 951484321 951484357 652743081 652743121 348825251 348825329 867972514 867972600 513128490 513128567 607986644 607986714 756541197 756541296 870225573 870225671 104885069 104885125 886026019 886026112 …
Output: 1

Example 2:

Input: 342 194992713 194992807 94502618 94502692 436905408 436905470 969364290 969364304 173633140 173633194 17682289 17682374 791135493 791135500 46201126 46201135 514632905 514632993 303547487 303547569 766763944 766764009 917943271 917943289 970173081 970173175 240497923 240498012 253477302 253477323 969278012 969278031 9819591 9819612 353433864 353433953 591735997 591736060 430607700 430607734 29030629 29030648 992413198 992413297 394857161 394857172 323222525 323222557 379554285 379554339 976343497 976343510 713197 713204 498736387 498736391 97525336 97525414 967317414 967317510 488625634 488625672 158709407 158709465 99495838 99495932 71788288 71788367 945437866 945437954 112319638 112319684 990272705 990272716 876744663 876744748 57219308 57219397 675828604 675828638 176646781 176646822 40…
Output: 1

Example 3:

Input: 291 533358923 533358991 417881429 417881529 769710350 769710389 326871916 326871985 955325839 955325849 672408448 672408542 974980875 974980973 404914295 404914346 694948776 694948872 180978292 180978392 942933644 942933698 900662374 900662418 776360538 776360634 931801993 931802008 313090580 313090626 46020912 46020987 984052799 984052862 230705794 230705881 249166242 249166330 346424930 346425028 803621605 803621679 573133575 573133646 477138287 477138335 625182775 625182827 980363791 980363845 42172012 42172064 12926218 12926294 648150953 648151025 201352039 201352040 901158935 901158969 823466106 823466135 56639273 56639324 568695263 568695268 28837291 28837313 761927044 761927120 293809049 293809128 630208976 630209033 589362070 589362086 864141671 864141698 549351154 549351155 134558…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Miller and the Moonlit windows - MEDIUM Coding Problem | CodeTikki