CT33749

Theo's Saffron segments

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Theo inherited the dairy at the lantern reef of Glowtide along with its curious bookkeeping system for segments. Time to make sense of it. 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 <= 2451; 0 <= s < e <= 10^9.

Example 1:

Input: 794 415725474 415725562 754729131 754729153 160266848 160266937 672389195 672389292 318971328 318971367 219099504 219099587 487080162 487080254 559341898 559341901 628031448 628031524 321037977 321038075 899336467 899336529 538894476 538894506 787566025 787566101 4423851 4423856 142993693 142993768 72546804 72546860 969948434 969948523 882286033 882286097 392047219 392047287 180231222 180231267 718524454 718524480 513426085 513426093 96048370 96048450 174972585 174972654 979006804 979006898 847349810 847349883 232599095 232599100 538614220 538614253 516470371 516470432 269577346 269577377 549407412 549407490 410052212 410052224 1471814 1471910 939820326 939820396 489605135 489605139 68926288 68926309 441146695 441146718 861990775 861990805 457254001 457254060 25129247 25129307 236556388 23…
Output: 1

Example 2:

Input: 1280 128987507 128987596 191764604 191764691 729569216 729569260 937862745 937862794 901592338 901592412 83757562 83757613 389027014 389027035 298498904 298498937 287350285 287350327 896613880 896613966 604339572 604339603 856643046 856643096 739016619 739016659 955761568 955761648 231103234 231103244 460781666 460781758 922853156 922853180 97168726 97168814 224062112 224062152 691199317 691199326 171926520 171926602 709690592 709690682 958208738 958208819 474213087 474213142 106151751 106151833 702567282 702567349 74821987 74822074 372496928 372496966 810019065 810019151 889232971 889233014 28121512 28121517 846551251 846551309 774178077 774178109 553088678 553088706 13188581 13188664 932874133 932874173 498709376 498709434 786050270 786050314 17044189 17044254 41487610 41487648 165412868…
Output: 1

Example 3:

Input: 2043 2395098 2395185 994888719 994888796 28434356 28434378 733191117 733191132 928449130 928449151 947627815 947627901 380236625 380236722 239216353 239216406 452225119 452225203 413786710 413786723 338464359 338464389 179255713 179255744 111714183 111714188 101062582 101062648 845970658 845970728 692934567 692934611 891443802 891443896 456664669 456664728 298179357 298179362 958345876 958345943 445540253 445540323 464970625 464970704 550013403 550013499 565302929 565303009 803806090 803806131 367465696 367465753 891637267 891637362 182976834 182976915 758948081 758948148 491070545 491070581 650535149 650535233 311511911 311511941 47131978 47132052 276859238 276859243 621137090 621137098 901628417 901628424 84276550 84276576 866287931 866287951 465471976 465472073 914984619 914984656 10488…
Output: 1

Constraints:

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

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