CT33031

Nina's Ledger of scrolls

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Morning light hits the crane marshes of Stillwater as Nina unrolls the day's manifest of scrolls. The tally will decide the next shipment. 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 <= 1837; 0 <= s < e <= 10^9.

Example 1:

Input: 1590 874151798 874151878 791566290 791566340 513654642 513654668 727069450 727069486 688291300 688291375 910249467 910249502 837748393 837748424 871608054 871608121 974920712 974920771 408806851 408806893 507890515 507890570 44246333 44246368 942885869 942885937 338957300 338957350 879545217 879545232 567852894 567852899 471674950 471675006 159089443 159089513 489898206 489898306 894984847 894984877 718764611 718764687 826065303 826065335 479925656 479925695 448886386 448886414 341581188 341581191 66581092 66581182 982374705 982374749 918914346 918914399 128295581 128295667 829505685 829505720 619249752 619249753 563518959 563519024 17805891 17805897 453597096 453597187 593508251 593508256 400199884 400199938 812984809 812984813 102645190 102645268 726073708 726073768 717564348 717564393 8…
Output: 2

Example 2:

Input: 995 738987864 738987923 484745618 484745670 185917213 185917304 785889910 785889914 906333709 906333777 670408877 670408930 514509846 514509855 573191052 573191149 995180680 995180740 234020333 234020360 625796745 625796833 171958966 171959063 26493581 26493680 910722384 910722437 462396357 462396383 989890994 989891076 563680654 563680657 810236016 810236083 993286726 993286739 646856685 646856725 135013333 135013432 510232646 510232671 464845484 464845518 108836057 108836107 639008769 639008812 255684690 255684713 853421796 853421859 84800299 84800351 199425565 199425581 911774968 911774972 950175424 950175453 956269014 956269054 163496929 163496990 259970321 259970412 874199854 874199949 804183301 804183383 338489781 338489788 414297118 414297141 863604427 863604493 933868842 933868877 …
Output: 1

Example 3:

Input: 1297 698226066 698226154 9026945 9026965 400782609 400782624 946338277 946338312 160132099 160132169 638921103 638921201 210853176 210853271 56993217 56993306 679420123 679420146 662388876 662388973 871441013 871441073 267980693 267980713 404412257 404412343 504371116 504371190 950250309 950250376 726577692 726577752 713213843 713213873 72370667 72370704 459894949 459895000 274190273 274190358 573374835 573374931 469927212 469927303 590918757 590918776 540936276 540936376 693053436 693053531 952089819 952089899 372821721 372821778 930201676 930201738 268839726 268839765 905368438 905368510 110512621 110512644 95662624 95662628 803086353 803086382 153462077 153462138 833639549 833639615 255161823 255161909 715576358 715576429 141645506 141645511 896931136 896931149 665583433 665583441 77135…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Nina's Ledger of scrolls - MEDIUM Coding Problem | CodeTikki