CT54604

Gautam and the Busy Hall

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the tannery row of Leatherwick; Gautam weighs the day's stretches manifests and starts the calculations. 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 <= 1393; 0 <= s < e <= 10^9.

Example 1:

Input: 462 167706752 167706837 959549597 959549599 335560660 335560700 5832856 5832941 931278405 931278436 943110682 943110716 420352765 420352776 56905141 56905206 900130861 900130876 852683981 852684075 55816090 55816113 7064882 7064892 153741811 153741854 7612874 7612922 524995432 524995524 980666754 980666816 893076981 893077001 447344798 447344832 505584875 505584927 573091684 573091748 834984489 834984513 945287878 945287928 982084285 982084312 427217866 427217920 586411658 586411707 547707942 547708015 424559288 424559346 940441250 940441282 410546712 410546753 236533812 236533900 894683232 894683313 114851616 114851689 494082215 494082286 444350377 444350413 909902490 909902524 761375129 761375174 743215171 743215230 277645 277662 356831662 356831695 589099397 589099431 338632777 33863284…
Output: 1

Example 2:

Input: 900 530316927 530316946 185678827 185678863 528135109 528135131 917589802 917589878 267052770 267052773 884298700 884298787 140196880 140196931 749889281 749889370 721014194 721014220 90826856 90826900 417458486 417458586 537614110 537614179 564941737 564941770 474283213 474283257 965259973 965259988 361022871 361022946 546957595 546957620 789324242 789324334 994499886 994499887 58606138 58606183 330170899 330170903 738493175 738493226 752039022 752039043 572898996 572899037 477863946 477863967 970781332 970781378 182625327 182625339 501810935 501810992 810811186 810811274 854119456 854119509 923380945 923381038 471366120 471366194 47673499 47673504 757716595 757716685 109732751 109732806 617383232 617383285 586041175 586041210 454688128 454688227 250978555 250978574 774131061 774131127 66…
Output: 1

Example 3:

Input: 151 44491195 44491266 957870882 957870922 685543568 685543590 987481472 987481528 950700840 950700865 23147592 23147654 168368276 168368374 774029525 774029584 998008748 998008767 907901082 907901088 374434193 374434196 172478245 172478322 804838403 804838480 947312867 947312962 127530193 127530262 143874772 143874788 909101985 909102054 842046609 842046633 984669269 984669365 941415816 941415817 272898612 272898679 895947169 895947174 655771841 655771842 40246305 40246340 841151621 841151628 826832061 826832064 425246700 425246774 380421029 380421097 804228373 804228456 850461689 850461691 951293768 951293853 957229958 957230047 431800206 431800220 599350304 599350339 516056877 516056913 757512357 757512451 144558529 144558596 652937838 652937869 926312484 926312514 125879716 125879730 13…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.