Loading...
Loading...
Loading...
A hall hosts n events, each with a start time s and an end time e. An event is running at times s up to, but not including, e. Print the largest number of events running at the same time, and the earliest time when that number is reached.
Example
Input
4 9 11 10 12 10 13 14 15
Output
3 10
Three events run at time 10.
Try the problem first. Open one hint at a time.
Times go up to 10^9, so a list of that size is too large. Keep only the times where something changes.
Add 1 at each start and subtract 1 at each end in a Counter, then sweep the sorted times.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor