CT31153

The Jade Busy Hall

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Jaya found an old ledger of segments in the gallery attic at the poppy fields of Scarlet Plain. The margin notes pose a precise question. 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 <= 1739; 0 <= s < e <= 10^9.

Example 1:

Input: 227 49749409 49749437 909543302 909543347 581685777 581685807 132104667 132104702 727129594 727129613 227882159 227882246 119542420 119542520 249778560 249778566 734293761 734293836 355377868 355377923 859971600 859971679 271319703 271319779 254629207 254629255 858881190 858881230 26023263 26023330 623345863 623345898 795803123 795803145 249675983 249676036 594705912 594705956 159937927 159937931 385777870 385777923 252411754 252411817 71424239 71424298 214510003 214510034 758303882 758303893 627439897 627439945 252788686 252788697 123330707 123330779 297516158 297516184 909434664 909434680 549539016 549539054 255095729 255095778 222574333 222574394 658395862 658395886 44441260 44441326 279649372 279649390 73467554 73467563 67815628 67815638 572023937 572024020 38364713 38364809 313454875 …
Output: 1

Example 2:

Input: 443 424463509 424463512 153207552 153207608 686733122 686733219 736747346 736747351 676724916 676725005 911309091 911309116 498486505 498486529 119687403 119687468 196306423 196306482 815505578 815505594 516278244 516278338 6660335 6660430 313985414 313985427 14510755 14510785 602970664 602970722 345055443 345055495 539149306 539149322 136879669 136879731 864208256 864208343 294632965 294633064 433248371 433248469 87077425 87077493 812176755 812176819 20654121 20654146 428885162 428885260 295209610 295209700 598346717 598346762 966446140 966446168 562298158 562298184 412491533 412491554 743930738 743930742 915829983 915830044 193761413 193761459 561609503 561609600 244601653 244601729 659940394 659940398 26639890 26639943 814121749 814121750 894017019 894017082 241080482 241080548 23315413…
Output: 1

Example 3:

Input: 1060 399111347 399111353 366587208 366587249 588426724 588426756 859949303 859949343 839211678 839211769 22258587 22258661 177175947 177176046 82746415 82746448 891016901 891017000 687183890 687183938 847281161 847281240 607513764 607513802 62944644 62944662 167701342 167701369 4623028 4623101 799802163 799802255 962908031 962908077 135379076 135379109 921859350 921859445 79839940 79840029 915935398 915935448 904293600 904293637 264842143 264842202 141036689 141036735 967738052 967738113 860159862 860159958 26430168 26430197 305569334 305569413 771825446 771825454 374437279 374437351 688196691 688196788 24542521 24542557 510927766 510927865 257653965 257653988 199910753 199910777 360517079 360517090 173590352 173590430 701537258 701537291 526919846 526919885 489426313 489426403 566146084 5…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Jade Busy Hall - MEDIUM Coding Problem | CodeTikki