CT46322

The Topaz ribbons of Ishaan

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the temple city of Sunspire close for winter, Ishaan must finish the ribbons ledger - one figure at a time. 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 <= 1323; 0 <= s < e <= 10^9.

Example 1:

Input: 19 221628718 221628759 583573822 583573900 870964980 870965039 544829181 544829185 441879281 441879350 101777769 101777836 85396795 85396804 434209461 434209487 729138320 729138354 104778496 104778526 496631252 496631351 542254327 542254379 105145836 105145853 912844703 912844765 799883063 799883117 462748821 462748892 842690234 842690236 90355885 90355927 482119273 482119320
Output: 1

Example 2:

Input: 461 231104608 231104648 921372014 921372088 564067478 564067510 634779371 634779469 332565953 332566000 309659951 309660012 264451959 264452052 335096004 335096045 427494708 427494736 6746742 6746833 200885833 200885930 116605383 116605423 361274986 361274997 780164098 780164137 339045036 339045042 226949375 226949412 579323767 579323830 147506930 147506971 356396080 356396161 889076691 889076786 876250254 876250333 47929867 47929882 928214324 928214398 644660319 644660407 191526707 191526761 883496873 883496942 529403604 529403610 816522648 816522671 467129732 467129798 770514557 770514580 730810189 730810217 321212847 321212887 28429335 28429367 721690697 721690754 83049000 83049073 518032887 518032911 494383808 494383858 781738628 781738629 541559320 541559410 81205679 81205747 53374054…
Output: 1

Example 3:

Input: 919 121427342 121427378 599751175 599751213 991656424 991656499 488078184 488078194 659486237 659486329 535209981 535210032 954651878 954651903 706943811 706943856 264419971 264420067 348082507 348082544 142907772 142907859 559390370 559390417 673857759 673857850 485708931 485708968 709972434 709972437 761437962 761438055 701588610 701588666 461230900 461230955 379973932 379973960 994051968 994051985 939237570 939237587 377624019 377624051 975464352 975464372 367324010 367324016 232106712 232106734 290564795 290564835 743230067 743230151 684652 684728 560318572 560318599 40934990 40934997 305295189 305295282 820317561 820317615 693082423 693082456 904598454 904598464 468727675 468727749 570504551 570504552 913917623 913917661 216865350 216865438 810175592 810175648 667716398 667716493 9127…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Topaz ribbons of Ishaan - MEDIUM Coding Problem | CodeTikki