#C5455. Minimum Meeting Rooms

    ID: 49106 Type: Default 1000ms 256MiB

Minimum Meeting Rooms

Minimum Meeting Rooms

You are given a list of meetings, where each meeting is represented by its start and end time. Your task is to determine the minimum number of meeting rooms required so that all meetings can be held without any time conflicts.

Two meetings conflict if the start time of one is less than the end time of another meeting currently using a room. In mathematical terms, two meetings with start times s1 and s2 and end times e1 and e2 respectively do not conflict if either
\( s_1 \ge e_2 \) or \( s_2 \ge e_1 \).

It is guaranteed that the time values are non-negative integers. If there are no meetings, the answer is 0.

inputFormat

The input is given via standard input (stdin). The first line contains a single integer (n) indicating the number of meetings. Each of the next (n) lines contains two space-separated integers representing the start and end times of a meeting.

outputFormat

Output a single integer to standard output (stdout) denoting the minimum number of meeting rooms required.## sample

3
0 30
5 10
15 20
2