CT43355

Last segments of Omkar

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the terraced vines of Grapehollow pays by the answer, and Omkar intends to earn it. First: the full register of segments. 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 <= 1011; 0 <= s < e <= 10^9.

Example 1:

Input: 469 872502397 872502408 991821698 991821793 756464034 756464042 850106460 850106556 660269477 660269528 369185481 369185526 566258121 566258201 867943227 867943274 711239353 711239416 39011699 39011724 742998588 742998669 277197801 277197859 408429586 408429590 607430748 607430753 763414321 763414407 969421704 969421719 879898569 879898636 371074078 371074105 144289765 144289862 406784382 406784442 726020082 726020107 421556762 421556803 645960380 645960441 634950489 634950563 548909490 548909513 694287949 694287966 615773909 615773966 722068080 722068099 849799044 849799144 381326450 381326487 643440046 643440075 776805870 776805876 655632193 655632228 877293861 877293862 669608906 669608952 619416967 619417042 922246575 922246580 186216932 186217005 54015425 54015462 212575864 212575885 …
Output: 1

Example 2:

Input: 948 237618381 237618465 570077606 570077655 998709591 998709608 698030896 698030928 818806838 818806858 652017673 652017720 791725429 791725456 656087017 656087097 200384220 200384262 312027958 312028033 508253488 508253542 255552110 255552205 359860992 359861021 54277763 54277831 33038118 33038154 201241875 201241971 251957116 251957180 818813715 818813736 899980254 899980320 620692159 620692258 839443164 839443176 844438507 844438535 579666537 579666605 274266337 274266390 56697639 56697643 46876091 46876129 647823045 647823144 558006353 558006406 917263453 917263544 535553743 535553777 567297279 567297358 929991699 929991741 778184310 778184379 944702656 944702657 327015443 327015469 795842740 795842743 476416951 476417011 815864256 815864314 508421267 508421291 474475183 474475251 4715…
Output: 1

Example 3:

Input: 843 918872105 918872200 326944279 326944319 930750335 930750426 346553822 346553836 432550818 432550857 312158212 312158236 299241392 299241451 51937005 51937095 695029696 695029788 435169605 435169625 788544497 788544578 621085490 621085579 292964864 292964950 219438613 219438618 380335635 380335669 770504265 770504314 512697339 512697434 929999426 929999485 781331535 781331580 166055608 166055665 191637281 191637296 736668004 736668061 821616956 821617021 984071255 984071328 973287459 973287482 30576333 30576430 330659808 330659881 840054928 840054976 147158888 147158930 118110739 118110832 829112997 829113058 128826485 128826554 470512132 470512147 959994626 959994654 113341933 113341974 628914755 628914795 685918935 685919007 784185421 784185422 559730336 559730432 598589623 598589700 …
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Last segments of Omkar - MEDIUM Coding Problem | CodeTikki