CT34648

The Goldmeadow Busy Hall

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Legend says the vault under the trading post of Goldmeadow opens only for a perfect tally of segments. Wasim means to find out. 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 <= 2292; 0 <= s < e <= 10^9.

Example 1:

Input: 180 855353593 855353666 831334415 831334507 371966614 371966646 796790851 796790885 746526459 746526538 411067074 411067131 818188279 818188317 342993493 342993549 736121108 736121154 130902647 130902727 327977418 327977511 930049381 930049422 323952376 323952414 774792135 774792234 781405494 781405498 584522584 584522660 812692217 812692290 856652744 856652835 469962319 469962385 372937777 372937798 772049144 772049231 989812942 989813040 993480036 993480079 236435394 236435469 250321788 250321801 429274589 429274634 561122861 561122888 338662218 338662245 165042438 165042477 411992185 411992241 461095821 461095834 223642400 223642402 565001807 565001900 850903671 850903695 814391117 814391216 660803952 660803955 431277948 431277978 613105975 613105993 867153672 867153700 128290702 128290…
Output: 1

Example 2:

Input: 410 61867900 61867916 145262486 145262533 135099527 135099569 706007637 706007658 642254520 642254567 598226070 598226142 114942776 114942858 899381072 899381134 630171146 630171155 86613529 86613579 514597588 514597685 97170683 97170745 632326890 632326919 968342770 968342814 780352535 780352608 627999110 627999205 724922264 724922318 877831678 877831774 771870982 771871053 495147889 495147969 202318387 202318455 331011837 331011863 150614493 150614591 648967145 648967173 768088341 768088426 357826591 357826677 311459531 311459545 217637099 217637169 471015100 471015125 947196813 947196849 328885589 328885615 69518783 69518801 29837372 29837393 875419289 875419318 466736445 466736466 883640879 883640887 987654825 987654854 66264440 66264460 661139780 661139815 54361214 54361273 866450690 …
Output: 1

Example 3:

Input: 2174 502823647 502823714 426530166 426530222 657191729 657191765 707753362 707753411 645411049 645411092 78106256 78106258 55699034 55699036 722613696 722613744 183406365 183406401 665212781 665212797 521698660 521698757 181438679 181438774 252220105 252220146 163364045 163364141 479818142 479818201 966740228 966740258 426944455 426944472 514437622 514437630 660443048 660443082 81988005 81988061 826014982 826015028 459118430 459118516 453239634 453239688 510599736 510599803 770635781 770635849 133974160 133974163 408317174 408317200 597986870 597986898 192961370 192961399 132849520 132849554 436649631 436649653 428399400 428399467 162756992 162757060 688295601 688295691 441472495 441472522 185873721 185873726 588086323 588086398 431862088 431862157 932419721 932419747 379810285 379810302 5…
Output: 1

Constraints:

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

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