CT51939

The segments Busy Hall Puzzle

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Leon the registry keeper watches over the jade shrine of Serpentis's stores of segments. A careful computation stands between order and chaos. 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 <= 2621; 0 <= s < e <= 10^9.

Example 1:

Input: 2551 415313719 415313723 627987656 627987670 595384829 595384895 196715636 196715727 682967234 682967315 518216987 518217031 435470478 435470546 742487433 742487463 457469100 457469123 363498210 363498273 433919377 433919414 100788221 100788239 516917877 516917933 580686316 580686381 231339579 231339620 388717721 388717763 918539354 918539425 422205054 422205112 957788087 957788129 626381012 626381062 680519049 680519144 49542461 49542525 507353525 507353602 646695026 646695028 536934435 536934481 15326464 15326527 823002393 823002476 469519387 469519399 655377431 655377438 427371153 427371251 629200592 629200610 715777273 715777317 655929603 655929679 620760634 620760726 190431786 190431813 444689963 444690042 950559502 950559571 792549952 792550016 985753538 985753553 44984936 44984942 3…
Output: 1

Example 2:

Input: 2251 136635035 136635051 72797428 72797523 142254300 142254313 291578652 291578678 969932441 969932515 300208137 300208220 480420426 480420475 711186923 711186931 718513747 718513814 750148467 750148557 605067152 605067184 906302032 906302089 445948783 445948845 643925792 643925885 269344147 269344220 165154040 165154067 240978634 240978718 588612193 588612267 438214200 438214211 350290079 350290088 64982933 64982978 458794034 458794079 814491450 814491494 845416781 845416792 822999510 822999541 444909780 444909865 230723526 230723530 942979769 942979843 288079173 288079197 772384595 772384598 659488313 659488404 876597911 876597949 923819079 923819144 95500722 95500791 139103481 139103579 814945430 814945476 535198912 535198993 643577957 643577959 9978246 9978333 919723493 919723590 96673…
Output: 1

Example 3:

Input: 1302 179748092 179748157 953516355 953516362 356343845 356343882 768909712 768909747 448422421 448422450 165753289 165753358 980603491 980603564 64281251 64281351 113662916 113662975 74074706 74074727 13889077 13889155 488043413 488043443 224711906 224711971 810095667 810095760 993825221 993825284 429644815 429644865 102334625 102334686 403032879 403032942 407704443 407704526 839248852 839248927 891042504 891042590 782928591 782928640 632908998 632909025 817641104 817641160 57486880 57486955 897758412 897758489 138033877 138033895 158230913 158230972 453942682 453942689 796130756 796130822 551606269 551606336 521963607 521963684 546680034 546680052 630851366 630851375 140398695 140398789 702658489 702658566 848786515 848786606 676101640 676101643 728330594 728330605 292154814 292154877 282…
Output: 1

Constraints:

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

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