CT31628

Last segments of Jaya

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Jaya the dispatch writer watches over the granite steps of Stonehallow's stores of segments. A careful computation stands between order and chaos. 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 <= 2768; 0 <= s < e <= 10^9.

Example 1:

Input: 2523 963594896 963594909 3911797 3911807 856180501 856180559 470112545 470112635 297767998 297768042 215161507 215161582 296807439 296807486 705488596 705488611 867073455 867073460 641885009 641885061 512642393 512642484 674076999 674077024 616762045 616762087 263809551 263809579 713501545 713501598 493149100 493149168 930615034 930615131 962947183 962947270 360075331 360075407 657250473 657250550 124753588 124753662 668896800 668896833 961812929 961812932 812228553 812228593 737284753 737284757 681998297 681998323 945691539 945691582 841731259 841731320 541141425 541141478 522834115 522834132 993440319 993440417 371643106 371643144 714120981 714121035 486277432 486277502 438712649 438712665 661510190 661510193 992902080 992902148 68629810 68629862 474390121 474390181 425841841 425841928 3…
Output: 2

Example 2:

Input: 528 485021050 485021069 422664928 422664947 551746413 551746513 163746534 163746579 404047093 404047107 911115718 911115737 802836520 802836578 85370397 85370477 623434105 623434138 289717178 289717269 436555109 436555130 363728286 363728342 823618950 823618998 97104449 97104541 988792535 988792585 384980784 384980833 19229569 19229594 586943190 586943271 659550190 659550254 469140690 469140779 889940459 889940545 666966900 666966971 904290834 904290892 628433297 628433325 436676215 436676217 816013236 816013290 348106041 348106047 810049746 810049827 430104227 430104270 84874744 84874833 488499460 488499501 822028830 822028882 560855576 560855663 531127975 531128075 576729285 576729319 770448013 770448090 667181241 667181303 494803370 494803454 295225737 295225814 780778664 780778739 4769…
Output: 1

Example 3:

Input: 272 933405439 933405465 501171864 501171930 92226892 92226913 943891355 943891399 418421265 418421314 289231811 289231815 280845854 280845946 91294654 91294746 898707659 898707756 941684765 941684844 373061717 373061807 910784002 910784017 705540476 705540528 371097069 371097140 853033256 853033294 427019297 427019376 767454077 767454136 387331476 387331519 44403895 44403961 476337675 476337690 39648103 39648178 419053969 419054031 558770437 558770508 15516535 15516628 92546054 92546066 502425515 502425538 413433459 413433511 113345460 113345549 975460715 975460774 885923409 885923472 874307946 874307965 706502805 706502902 408356541 408356559 236281039 236281075 212754844 212754863 559325749 559325751 932291214 932291297 401064615 401064650 991424564 991424627 244757859 244757956 54467516…
Output: 1

Constraints:

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

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