CT29846

Elsa's Umber scrolls

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The measurer Elsa has been asked to recover the missing manifest. On the desk lies a long table of scrolls readings. 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 <= 1356; 0 <= s < e <= 10^9.

Example 1:

Input: 1026 609514120 609514124 948419436 948419493 545698046 545698072 690044621 690044655 19824754 19824772 473419382 473419447 732259632 732259673 233326182 233326183 350343395 350343447 406641199 406641219 20931066 20931144 624569386 624569411 859798811 859798911 287237136 287237165 172925030 172925056 616889113 616889206 181637157 181637224 670563982 670564011 177929049 177929056 701508180 701508186 159242963 159243039 856619985 856620044 312700962 312701032 771676543 771676577 320632302 320632350 945236127 945236215 524440704 524440760 551963764 551963825 176832753 176832779 238757574 238757612 945696555 945696578 536933974 536934033 808585168 808585248 956339102 956339106 979775531 979775569 140439932 140439959 62625913 62626007 849655488 849655556 310629959 310630047 228303838 228303893 2…
Output: 1

Example 2:

Input: 1073 231226408 231226439 561371008 561371100 833724293 833724348 532782581 532782681 755884496 755884508 6193564 6193567 202853400 202853418 805398110 805398174 453644928 453645000 142861415 142861463 363102231 363102296 235205528 235205609 38157164 38157251 857690819 857690829 426397332 426397377 864026948 864027035 117170550 117170614 836790514 836790545 322090724 322090779 480149617 480149640 818584372 818584464 1104981 1105029 237733704 237733732 419383368 419383385 24435463 24435511 321438055 321438151 154462876 154462907 346402617 346402665 305282314 305282341 59896685 59896737 605990813 605990873 862401738 862401801 292668174 292668227 415899126 415899129 647070895 647070903 426762827 426762925 874768002 874768055 517632998 517633015 639737045 639737142 437985560 437985636 226074558…
Output: 2

Example 3:

Input: 596 564076894 564076964 494843238 494843252 764621519 764621522 211290703 211290747 570277801 570277871 694931134 694931162 84860301 84860365 809187315 809187404 220988743 220988776 716132624 716132650 161306288 161306356 363575766 363575798 228678897 228678976 803873052 803873127 651001561 651001624 665833440 665833521 60282580 60282638 995595189 995595214 50543984 50544032 928192248 928192321 645644631 645644654 928512492 928512524 109116383 109116436 589272378 589272424 954744971 954745057 400139559 400139563 441195219 441195243 825552331 825552367 372820885 372820897 261422912 261423006 511261357 511261428 871681413 871681497 312444174 312444216 9240326 9240341 810328207 810328247 609840882 609840964 723799403 723799432 649019893 649019927 452712953 452713036 53582825 53582838 31076819…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Elsa's Umber scrolls - MEDIUM Coding Problem | CodeTikki