CT50911

Farmer Counts the windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Farmer runs the timber yard at the observatory of Starfall. Today the books show a list of windows, and the numbers must be worked out before sundown. 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 <= 2765; 0 <= s < e <= 10^9.

Example 1:

Input: 1861 193533725 193533806 763657627 763657639 680041954 680041987 934908029 934908118 698691010 698691061 261934741 261934769 272163937 272163940 309172391 309172450 856259624 856259722 192730110 192730161 824045284 824045314 967601712 967601799 958219022 958219085 599098 599187 267081266 267081325 317190404 317190500 471711614 471711681 219987619 219987622 905900987 905901017 529217903 529217965 798066322 798066360 184189522 184189560 337421122 337421205 344330390 344330488 486963443 486963513 840559353 840559420 417751312 417751344 899827790 899827821 315919855 315919869 298551202 298551220 504158930 504158943 36549963 36550061 196789792 196789882 244010682 244010773 990059719 990059813 333638827 333638879 61706407 61706436 81134128 81134205 878559274 878559329 983729141 983729164 5949119…
Output: 1

Example 2:

Input: 2674 383000181 383000223 330785803 330785839 870361326 870361347 524140926 524140953 717032268 717032311 798182392 798182444 782592385 782592441 963607061 963607102 744359209 744359306 778243716 778243745 201592692 201592700 177722768 177722854 891335328 891335401 351076361 351076370 590569441 590569539 137581412 137581484 795549431 795549444 286636564 286636581 619193318 619193377 545918899 545918963 221362154 221362192 768330402 768330495 242492862 242492948 824575503 824575602 784030215 784030246 600066871 600066893 869820646 869820726 59648656 59648741 471648617 471648713 190771206 190771247 3624218 3624285 96912786 96912867 830984121 830984128 680489242 680489261 426816765 426816819 343329808 343329884 175977652 175977689 665015240 665015302 892476096 892476168 525476846 525476870 470…
Output: 1

Example 3:

Input: 2454 586087118 586087147 708124902 708125000 898376288 898376354 758039579 758039625 425564739 425564784 822134073 822134087 979979628 979979646 586893099 586893192 889745621 889745626 413946578 413946607 970135587 970135608 40689418 40689500 751145480 751145498 643071675 643071736 757527431 757527450 500392725 500392821 654982587 654982661 355341412 355341437 243330841 243330906 377221455 377221459 370948506 370948521 826355104 826355130 722838075 722838116 890101238 890101323 343036178 343036246 145224660 145224711 771694017 771694049 287754417 287754471 947901567 947901614 788841664 788841721 290172907 290172944 970949059 970949081 151773228 151773293 593678755 593678786 593999504 593999557 309864665 309864712 326226329 326226366 440987135 440987229 260338791 260338889 177614877 1776149…
Output: 2

Constraints:

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

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