#K6591. Minimum Meeting Rooms

    ID: 32302 Type: Default 1000ms 256MiB

Minimum Meeting Rooms

Minimum Meeting Rooms

You are given the schedules of various employees where each schedule consists of multiple events. Each event is defined by its start time and end time. Your task is to determine the minimum number of meeting rooms required to schedule all events without conflicts.

For an event with start time \(s\) and end time \(e\), the event occupies a meeting room from time \(s\) up to but not including time \(e\). Two events overlap if one event's start time is less than another event's end time.

The input begins with an integer \(n\) representing the number of employees, followed by \(n\) blocks of schedules. For each employee, the first number is \(m\) representing the number of events, and the subsequent \(m\) lines each contain two integers that denote the start and end times of an event.

inputFormat

The first line contains an integer (n) (the number of employees). For each employee, the first line contains an integer (m) (the number of events for that employee). Then, (m) lines follow, each containing two integers (s) and (e) (with (0 \leq s < e \leq 10^9)), representing the start and end times of an event.

outputFormat

An integer representing the minimum number of meeting rooms required to accommodate all events.## sample

3
3
60 150
30 120
200 220
2
100 200
140 180
1
180 210
3