#C8581. Maximum Overlapping Intervals
Maximum Overlapping Intervals
Maximum Overlapping Intervals
Given n intervals, each represented by a start time and an end time, determine the maximum number of overlapping intervals at any moment.
Formally, for each time t, consider the number of intervals \( [s_i, e_i) \) such that \( s_i \le t < e_i \). Your task is to find the maximum value among these counts, i.e., $$ \max_{t} \#\{i: s_i \le t < e_i\} $$
Note: The intervals are considered half-open, which means that if one interval ends exactly when another begins, they do not overlap.
inputFormat
The input is given via stdin in the following format:
n s1 e1 s2 e2 ... sn en
Here, n (1 ≤ n ≤ 105) is the number of intervals. Each of the next n lines contains two space-separated integers s and e (0 ≤ s < e ≤ 109), representing the start and end times of an interval.
outputFormat
Output via stdout a single integer representing the maximum number of overlapping intervals.
## sample5
1 5
2 6
8 10
3 7
5 9
3