#K8046. Minimum Venues for Overlapping Events

    ID: 35535 Type: Default 1000ms 256MiB

Minimum Venues for Overlapping Events

Minimum Venues for Overlapping Events

You are given several test cases. In each test case, a number of events is provided with their start and end times. Events that overlap in time must be assigned to different venues. Your task is to determine the minimum number of venues required to host all events without any time conflicts.

Note: If an event ends at time t and another event starts at time t, they do not overlap and can use the same venue.

The answer for each test case is the maximum number of overlapping events at any moment.

Input/Output: All input is provided via standard input and all output must be printed to standard output.

inputFormat

The input starts with an integer T (T ≥ 1) representing the number of test cases. For each test case:

  • The first line contains a single integer N, the number of events.
  • The next N lines each contain two integers, representing the start time and end time of an event.

Example:

2
3
1 4
2 5
4 7
4
1 3
2 4
3 5
5 6

outputFormat

For each test case, output a single integer on a new line representing the minimum number of venues required.

Example:

2
2
## sample
2
3
1 4
2 5
4 7
4
1 3
2 4
3 5
5 6
2

2

</p>