CT56374

Jarl's Wistful scrolls

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the acacia flats of Thornveld, Jarl records each scrolls in a worn leather ledger. The guild wants answers, not guesses. 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 <= 2671; 0 <= s < e <= 10^9.

Example 1:

Input: 378 869767379 869767441 130760606 130760616 24340711 24340759 986398339 986398364 15646527 15646614 117865470 117865489 710993240 710993336 686970882 686970942 373373697 373373788 628997192 628997193 205100077 205100136 69179515 69179536 163150127 163150215 685131674 685131774 786985619 786985658 988554750 988554771 203806017 203806080 333894739 333894772 452165928 452166027 506705158 506705206 808413984 808414031 427379496 427379563 589788583 589788642 846797404 846797464 847514069 847514074 79831565 79831584 394180114 394180173 91917899 91917913 409327996 409328018 468423801 468423866 810642848 810642941 791342420 791342463 202260107 202260108 653631347 653631405 841302313 841302409 451622885 451622894 259251383 259251437 982316978 982317076 869523154 869523193 466811059 466811096 711981…
Output: 1

Example 2:

Input: 1990 550601091 550601111 106744048 106744073 330276617 330276701 278500219 278500279 669571017 669571021 106311897 106311972 8453862 8453920 584031134 584031204 722593916 722593999 565088639 565088694 260623040 260623061 349705126 349705135 772974336 772974343 922411841 922411900 935645437 935645472 577165140 577165235 556030570 556030630 622826592 622826598 45806035 45806072 323286455 323286517 130392203 130392211 64820775 64820857 445094039 445094078 4097883 4097924 974838353 974838399 726453919 726453926 407433091 407433153 199493981 199494011 435191447 435191470 236125290 236125361 124523939 124523952 950512712 950512809 719609277 719609343 115455493 115455505 513670957 513670982 747489671 747489681 830601300 830601363 482418771 482418853 237520563 237520621 741330506 741330563 9280210…
Output: 2

Example 3:

Input: 1873 556040306 556040321 879426992 879427049 637324916 637324947 324390876 324390976 552896914 552896952 935870524 935870570 27259336 27259372 516815559 516815639 453766020 453766115 447434187 447434212 347979829 347979927 78129168 78129247 206006681 206006774 601785451 601785492 183504396 183504430 848750278 848750347 896415790 896415849 40960185 40960285 483511399 483511431 375846125 375846166 189593284 189593309 960295746 960295772 267438114 267438159 300294381 300294384 353176959 353177057 673117185 673117266 376963795 376963870 864487262 864487332 659458630 659458658 130133779 130133869 323547551 323547594 57164535 57164625 663745819 663745874 136662601 136662691 902998983 902999041 807409963 807410019 876920859 876920870 212332053 212332088 459522967 459522975 119263213 119263260 966…
Output: 1

Constraints:

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

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