CT39904

Last stretches of Nandini

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the saffron fields of Marigold Row. Nandini spreads the stretches records across the table and picks up a sharp pencil. 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 <= 1531; 0 <= s < e <= 10^9.

Example 1:

Input: 771 292078319 292078367 191855837 191855904 483044226 483044308 921349545 921349616 231319228 231319234 862939953 862940052 834562490 834562570 461251323 461251399 492187246 492187291 368535731 368535798 375822520 375822604 81179094 81179148 852212312 852212377 696467081 696467150 137623088 137623174 285552658 285552721 244324459 244324494 214360028 214360045 971355540 971355614 483632925 483632942 916501273 916501325 51807158 51807214 979650415 979650464 407073088 407073136 561279307 561279320 648415180 648415207 302196016 302196050 258811155 258811221 185518516 185518610 443994003 443994024 360403935 360403940 359455742 359455806 944927853 944927937 933596788 933596793 809586112 809586178 70191358 70191409 68830344 68830379 464998832 464998921 8883550 8883589 232761014 232761037 89312635…
Output: 1

Example 2:

Input: 1221 570763741 570763777 894803999 894804009 965892439 965892473 974312380 974312447 372734951 372734999 808707988 808708062 793507287 793507372 734919238 734919284 489325875 489325940 954675867 954675881 388842468 388842551 724778872 724778879 177859622 177859698 829877418 829877486 864341815 864341901 416291985 416292019 37599572 37599652 144792215 144792255 689590647 689590675 419024036 419024109 2939868 2939952 220794318 220794325 998004662 998004698 472654281 472654368 810179526 810179542 245466779 245466871 34180444 34180492 463656644 463656736 970757364 970757446 167497465 167497502 963622380 963622395 902334726 902334806 265319614 265319688 956724406 956724495 895535825 895535911 183997566 183997589 92030172 92030200 3063264 3063312 135842208 135842298 581400631 581400642 929566380…
Output: 1

Example 3:

Input: 91 981207689 981207751 976577072 976577168 651533534 651533610 605015214 605015268 410901083 410901150 26488620 26488704 404461591 404461686 347865699 347865775 780373772 780373822 786681210 786681234 513213579 513213598 106554680 106554755 948879248 948879334 261100886 261100985 850447261 850447351 812203158 812203202 941451055 941451128 587109509 587109543 892959837 892959843 794996690 794996734 220948482 220948555 615204343 615204426 826102950 826102972 46567990 46568050 232867269 232867312 824326669 824326736 104689587 104689660 571365767 571365825 683860491 683860551 330604401 330604443 578150121 578150189 302274773 302274792 299873336 299873349 695596126 695596202 857596194 857596257 716885920 716886003 648299169 648299240 413987467 413987557 848443734 848443781 595353859 595353958 4…
Output: 1

Constraints:

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

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