#C608. Max Concurrent Active Players
Max Concurrent Active Players
Max Concurrent Active Players
You are given a series of player sessions. Each session contains two integers representing the start and end times (in seconds) of a player's playing period.
Your task is to determine the maximum number of players active at the same time.
Note: If a player's session ends at time \(t\) and another player's session starts at time \(t\), they are not considered to be active concurrently.
The problem can be formulated as follows:
$$\max_{t}\left(\sum_{i=1}^{n} \mathbf{1}_{[s_i, e_i)}(t)\right)$$
where \(s_i\) and \(e_i\) are the start and end times of the i-th session, respectively.
inputFormat
The first line contains a single integer \(n\) — the number of sessions. Each of the next \(n\) lines contains two integers \(s\) and \(e\) (with \(s < e\)), representing the start and end times of a session.
outputFormat
Output a single integer, which is the maximum number of players active at the same time.
## sample3
1 5
2 7
4 6
3
</p>