CT31785

Jessa's Violet segments

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Jessa inherited the archive at the monsoon port of Rainhaven along with its curious bookkeeping system for segments. Time to make sense of it. 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 <= 2103; 0 <= s < e <= 10^9.

Example 1:

Input: 771 731475296 731475378 320071847 320071861 501967228 501967263 933587522 933587556 993695260 993695348 204491811 204491880 390662277 390662373 657023416 657023461 828153251 828153271 380089561 380089578 483324306 483324331 712274571 712274604 877185001 877185010 148350471 148350543 859539468 859539475 851833736 851833764 25740511 25740584 820046905 820046937 669777919 669778000 966109573 966109646 669224012 669224106 826751996 826752050 187168459 187168533 578869934 578869970 586658443 586658473 77404312 77404351 806939705 806939708 575972852 575972872 831142683 831142722 810953351 810953358 232876200 232876245 737927034 737927116 772546980 772547035 356434440 356434487 139806933 139806976 814059453 814059500 788758813 788758910 963090366 963090374 867097835 867097884 765381268 765381322 …
Output: 1

Example 2:

Input: 1172 677180804 677180882 371307825 371307877 42371909 42371968 433378567 433378651 47608479 47608541 482526349 482526356 348229162 348229169 802811921 802811929 263355333 263355369 333722115 333722210 755547015 755547067 414472932 414473018 50398675 50398724 30623681 30623699 807772346 807772426 581580113 581580185 958926119 958926125 684926468 684926536 112730267 112730289 649584865 649584873 640320438 640320537 594892318 594892416 214206640 214206696 473478800 473478828 178052801 178052890 655635143 655635178 593487205 593487277 414419043 414419086 856521801 856521823 732717694 732717762 194907786 194907852 165709507 165709587 719313391 719313415 290770175 290770236 999383474 999383490 729932703 729932712 283162620 283162720 365777175 365777224 50025241 50025276 753472234 753472246 80056…
Output: 1

Example 3:

Input: 1704 453453608 453453659 860696089 860696189 710079778 710079877 589550327 589550350 386122618 386122648 916017979 916018004 659202864 659202890 147413641 147413711 605696582 605696619 67924839 67924889 858071622 858071627 163371697 163371770 613745200 613745291 577197910 577197983 917499192 917499270 678435405 678435495 574445237 574445241 901346811 901346843 840817684 840817685 89495144 89495234 716884952 716885008 511072800 511072870 431263261 431263312 414477221 414477276 664940964 664940989 304023997 304023998 107414110 107414182 796954985 796955062 489292466 489292502 818810620 818810681 125075299 125075352 639079041 639079114 113272215 113272233 106549125 106549132 542086778 542086832 829443001 829443052 667292463 667292549 345698030 345698051 107608459 107608466 514317164 514317224…
Output: 2

Constraints:

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

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