CT47188

Chetan Counts the ribbons

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the granite steps of Stonehallow, Chetan records each ribbons in a worn leather ledger. The guild wants answers, not guesses. 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 <= 1146; 0 <= s < e <= 10^9.

Example 1:

Input: 559 636009417 636009466 25884304 25884369 713546734 713546738 525967476 525967557 692284555 692284587 562430664 562430751 307062701 307062730 973755857 973755934 790175743 790175833 681019847 681019897 372728696 372728789 543318154 543318165 259846180 259846248 161095444 161095491 629710826 629710900 93656476 93656559 839542002 839542075 548883227 548883305 933902868 933902923 280643783 280643820 554709482 554709579 327914206 327914209 498225746 498225772 292964433 292964521 124780284 124780322 476398462 476398492 679424938 679424967 1961402 1961450 706412272 706412305 944235843 944235915 355499461 355499472 134006947 134006980 918912480 918912541 628058313 628058370 271597118 271597120 78844536 78844602 606617497 606617592 984100041 984100056 244929216 244929259 288196514 288196551 207369…
Output: 1

Example 2:

Input: 790 869698933 869699032 377094652 377094747 86442780 86442843 860687652 860687697 206324195 206324231 967455284 967455356 248742773 248742856 119372828 119372926 434392865 434392962 564692054 564692067 68586067 68586103 775708902 775708981 916412652 916412734 556721915 556721919 483864497 483864574 578876037 578876111 745666034 745666062 574628562 574628658 324323828 324323840 288497828 288497845 824212907 824212976 227553611 227553684 807219098 807219125 251554296 251554391 144164845 144164871 772505380 772505392 731389084 731389176 670854974 670854988 663283907 663283947 750240163 750240238 760305485 760305538 324615959 324615992 33335429 33335528 17407302 17407399 383106253 383106266 581643177 581643185 778239399 778239438 929243964 929243989 122743363 122743421 225600581 225600591 6529…
Output: 1

Example 3:

Input: 316 49402186 49402194 39367743 39367744 730809320 730809321 463833327 463833337 670996343 670996397 181546037 181546069 36194313 36194356 285876822 285876834 690133938 690133967 441333016 441333074 2281612 2281698 989348511 989348563 156046657 156046701 652043228 652043310 993117036 993117106 634071974 634072009 44085819 44085825 156642999 156643056 590393322 590393381 771962101 771962162 3292970 3293045 920686005 920686007 472607681 472607728 568165400 568165477 117520586 117520674 782955321 782955409 760755580 760755652 679143257 679143280 469228726 469228763 345746167 345746263 203197198 203197297 452035100 452035103 940025547 940025559 91514814 91514873 315274595 315274608 747985299 747985339 742239520 742239544 55372504 55372510 317550318 317550406 528189546 528189567 223725756 223725…
Output: 1

Constraints:

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

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