CT35274

Nico's Busy Hall Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Nico found an old ledger of scrolls in the shed attic at the silver mines of Lodebarrow. 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 <= 1994; 0 <= s < e <= 10^9.

Example 1:

Input: 1781 97138967 97139033 916143640 916143691 796212605 796212635 878189666 878189746 656437738 656437756 794760980 794761030 66853013 66853044 805210974 805211067 892915853 892915872 422843869 422843934 462584432 462584433 284421770 284421814 478826857 478826924 155297037 155297114 133008308 133008331 875666548 875666648 111467098 111467193 590401696 590401710 540779761 540779795 219474936 219475033 659754591 659754620 612443391 612443404 572491489 572491518 185657704 185657734 244546778 244546845 119063782 119063855 200084305 200084384 196800483 196800545 781552885 781552943 542511738 542511769 318741574 318741588 523813691 523813712 951047783 951047868 61754558 61754656 877441080 877441165 105566712 105566739 988272414 988272495 222652001 222652053 142140029 142140094 174146835 174146916 6…
Output: 2

Example 2:

Input: 119 768220711 768220734 176456582 176456642 884074876 884074927 147868341 147868420 590443998 590444027 947610531 947610626 341696209 341696220 57646583 57646638 80996084 80996088 68942328 68942360 4815824 4815876 788238789 788238857 744934187 744934228 646076467 646076478 868498508 868498558 15491409 15491430 110090434 110090440 48328699 48328727 173132484 173132564 579963608 579963609 189907916 189908003 74271507 74271596 160333451 160333495 176122488 176122555 928317856 928317878 90403740 90403824 330406991 330407076 506228694 506228764 572114264 572114304 34192858 34192921 785682636 785682724 667989893 667989942 338234851 338234876 924123646 924123690 530006879 530006909 370480092 370480154 719977794 719977862 683362999 683363063 707015872 707015960 879873331 879873355 719931627 719931…
Output: 1

Example 3:

Input: 879 304023277 304023340 391396904 391396971 219405422 219405464 753313704 753313730 421391970 421392024 601168568 601168647 869289881 869289956 904550867 904550944 904230580 904230647 943994912 943994989 104462896 104462946 509255909 509255970 351445921 351445953 407579214 407579233 588404946 588405032 506147034 506147122 512435353 512435380 505134881 505134884 310340718 310340802 48109905 48109944 281405529 281405573 605151018 605151079 385914497 385914520 292940461 292940517 215738922 215738932 410593783 410593823 912832468 912832556 413178641 413178675 231921216 231921251 101251847 101251864 513062476 513062557 203092695 203092754 931561794 931561795 713169366 713169457 988328749 988328754 979888492 979888522 165763587 165763657 665181162 665181167 100399073 100399116 778092263 77809228…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Nico's Busy Hall Ledger - MEDIUM Coding Problem | CodeTikki