CT48445

Zaid's Ledger of segments

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the monsoon port of Rainhaven, Zaid the customs officer keeps careful count of the segments. balance the workshop's books, every figure matters. 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 <= 2513; 0 <= s < e <= 10^9.

Example 1:

Input: 620 640608024 640608084 137309923 137310012 825329088 825329164 415378798 415378862 694081184 694081281 397366802 397366860 389603107 389603136 359033122 359033131 774219476 774219532 581794598 581794608 96230065 96230122 333941158 333941196 123301978 123301986 437939703 437939747 577509499 577509533 988950606 988950617 171124395 171124420 203190337 203190424 157364267 157364318 196493563 196493578 628346584 628346600 62835289 62835342 731194952 731194957 135715505 135715589 453136818 453136885 60682513 60682586 747670325 747670399 329020307 329020321 745558710 745558773 819666496 819666545 641076174 641076271 617848546 617848601 107981431 107981457 796453280 796453341 865228557 865228602 163406702 163406802 960628613 960628656 92762188 92762236 289428009 289428090 953395086 953395141 8542…
Output: 1

Example 2:

Input: 2463 314246624 314246666 304280170 304280173 88286214 88286242 918534405 918534428 15000712 15000714 103770872 103770910 742491622 742491636 939658531 939658618 666586290 666586317 130983561 130983585 569514981 569515061 949812768 949812826 594285720 594285747 644330939 644331023 191799585 191799678 101510831 101510896 452339469 452339517 147542460 147542527 479820222 479820322 939655388 939655480 124172179 124172199 562860135 562860142 904002160 904002214 837598636 837598639 352882532 352882627 715284278 715284343 25505711 25505763 466373950 466373979 146553809 146553903 46355629 46355654 431652734 431652791 212712579 212712619 680289068 680289085 417694157 417694219 163442175 163442205 848783560 848783656 990360964 990360970 418263551 418263632 200954099 200954154 361420179 361420260 461…
Output: 1

Example 3:

Input: 28 832128559 832128640 913470503 913470579 952690131 952690171 866478247 866478336 43336605 43336705 510795540 510795597 205642231 205642294 126482957 126482966 8369840 8369935 289155821 289155830 42588997 42589072 257803309 257803398 262489021 262489075 272713014 272713109 536691214 536691252 450339632 450339652 232039920 232039931 580912802 580912809 318858756 318858822 18363975 18364009 80737710 80737794 27341359 27341439 475103488 475103568 332894981 332894994 914702874 914702971 49767039 49767128 971305044 971305073 355332060 355332061
Output: 1

Constraints:

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

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