CT54590

Eklavya's Busy Hall Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the ember mines of Cindercrag. Eklavya spreads the segments records across the table and picks up a sharp pencil. 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 <= 2207; 0 <= s < e <= 10^9.

Example 1:

Input: 1782 528455780 528455806 969231015 969231070 32702538 32702540 801187010 801187067 5471294 5471385 16935768 16935777 364596218 364596298 893161302 893161394 514728035 514728066 838209537 838209612 841490063 841490087 431198554 431198598 175484369 175484371 372986295 372986380 708162127 708162139 893855616 893855656 245518665 245518695 715007739 715007771 537639564 537639587 814954923 814954951 631156943 631156956 632693078 632693117 787482047 787482094 977739687 977739714 830195951 830195991 489680875 489680920 157672556 157672621 839591811 839591899 355146847 355146858 31794417 31794423 46219265 46219300 337455731 337455828 605572883 605572964 563589255 563589349 761137422 761137446 768729660 768729692 786064454 786064456 921787434 921787484 758239598 758239606 783302333 783302398 4539586…
Output: 1

Example 2:

Input: 1523 749709084 749709125 64968552 64968554 509740218 509740258 985444134 985444161 6031097 6031192 572714590 572714653 75654572 75654661 130806717 130806784 733610201 733610233 567380447 567380543 947395175 947395228 310174891 310174892 168706387 168706390 843641251 843641290 187974516 187974533 890993111 890993174 383630212 383630243 474600644 474600681 738870441 738870493 629142969 629143054 599921456 599921515 482791926 482792015 422122921 422122937 361403245 361403303 516201417 516201433 990070429 990070469 797292318 797292397 102988307 102988341 56171098 56171184 787099731 787099813 899710690 899710779 22629012 22629055 742290856 742290928 859779261 859779360 217712172 217712214 749389468 749389560 282285976 282286026 688908099 688908178 472292238 472292252 983063951 983063956 3948118…
Output: 1

Example 3:

Input: 839 788704367 788704383 727638009 727638095 26821146 26821180 731743972 731744069 251113168 251113206 633013818 633013888 966607775 966607808 526687723 526687739 273759616 273759692 94252051 94252058 155665268 155665355 211209351 211209376 391926629 391926665 369361710 369361719 937883213 937883261 429689272 429689366 65991901 65991999 613093994 613094014 118816360 118816421 968495878 968495908 390777672 390777684 774399533 774399542 333795887 333795914 398691720 398691762 617720962 617720970 417673563 417673612 360322346 360322361 770183945 770183970 754102482 754102515 236150182 236150257 728822859 728822887 45061307 45061308 854529163 854529191 147041554 147041620 214612691 214612758 581976171 581976218 249614610 249614652 168081089 168081092 647920263 647920351 742051288 742051295 6438…
Output: 1

Constraints:

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

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