CT32973

Ysolde Counts the segments

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Deep in the singing sands of Echo Dunes, Ysolde studies rows of segments entries. One clean number will settle the guild's oldest argument. 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 <= 2397; 0 <= s < e <= 10^9.

Example 1:

Input: 2085 521559405 521559425 270628013 270628022 274066196 274066235 155931272 155931306 6412679 6412755 124507378 124507412 798962737 798962760 628335847 628335888 329144628 329144686 987802396 987802428 546075901 546075942 375717464 375717473 29217782 29217797 119232144 119232177 138978312 138978367 49771557 49771594 168875337 168875356 557639885 557639971 556613772 556613802 269535100 269535172 569243057 569243116 819644408 819644421 392091885 392091942 267654947 267655031 413276003 413276013 122149615 122149696 236040883 236040906 45186652 45186659 854054802 854054810 390826578 390826596 954929090 954929154 720039259 720039292 541446777 541446822 303656031 303656114 244712011 244712050 757867532 757867601 97819440 97819495 533284437 533284492 331420120 331420146 925903496 925903508 9560505…
Output: 1

Example 2:

Input: 2202 859119119 859119211 647024966 647024970 682331477 682331536 389449709 389449752 18131410 18131435 262817970 262817982 55433554 55433635 889632695 889632741 662478869 662478898 945052922 945052945 290687665 290687692 559840556 559840597 989325971 989326051 556563961 556563986 661597485 661597500 36411541 36411568 877116132 877116232 511201472 511201479 410668992 410669042 32455906 32455940 826159243 826159324 32040430 32040436 543252946 543252987 29249205 29249305 358563160 358563233 371021767 371021815 608383373 608383465 983129323 983129347 31028706 31028732 365274971 365275005 649221278 649221360 577418275 577418371 347341638 347341734 770826589 770826661 77239086 77239095 462878218 462878287 269730189 269730284 957657149 957657235 516156296 516156358 226822971 226822988 679483323 6…
Output: 1

Example 3:

Input: 1144 284479421 284479455 190207242 190207335 521007986 521008062 913171022 913171087 567469012 567469071 292217262 292217340 718935008 718935089 16324107 16324148 279410943 279411008 162615116 162615123 729269893 729269937 572132744 572132826 811055450 811055496 223807617 223807654 565389650 565389741 446799740 446799770 327479900 327479989 736531595 736531647 514656275 514656313 795858258 795858310 23198208 23198295 770142592 770142673 669989789 669989811 652177814 652177828 949409425 949409514 526727096 526727119 696189802 696189804 38638433 38638531 301580249 301580275 212736047 212736072 951475910 951475948 21814170 21814230 32662456 32662537 517659319 517659329 337327520 337327544 181534439 181534526 868345423 868345431 408406366 408406451 204838754 204838846 292611016 292611036 65300…
Output: 1

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Ysolde Counts the segments - MEDIUM Coding Problem | CodeTikki