#C2847. Maximum Concurrent Attendees
Maximum Concurrent Attendees
Maximum Concurrent Attendees
In this problem, you are given a list of events, each specified by a start time and an end time. Your task is to determine the maximum number of events that are happening simultaneously. In other words, find the maximum number of overlapping intervals.
Conceptually, this problem can be solved using a sweep line algorithm. You process each event's start and end times as separate time points. When you encounter a start time, you increment the count of ongoing events; when you encounter an end time, you decrement the count. The maximum count observed during this process is the answer.
The time intervals are defined using two integers, and it is guaranteed that the input format is valid.
inputFormat
The input is read from standard input (stdin). The first line contains a single integer n, representing the number of events. Each of the following n lines contains two space-separated integers, which represent the start and end time of an event.
outputFormat
Print a single integer to standard output (stdout) representing the maximum number of events that are ongoing at the same time.
## sample5
1 4
2 5
9 12
5 9
5 12
3
</p>