#K33757. Overlapping Tasks Checker
Overlapping Tasks Checker
Overlapping Tasks Checker
This problem requires you to determine if any overlapping tasks exist for each employee. Every employee is assigned a list of tasks, where each task is specified by its start time, end time, and a task identifier. Two tasks are considered overlapping if the start time of a task is strictly less than the end time of the previous task after sorting by start time.
You will be given T test cases. For each test case, the first number represents the number of employees. For every employee, you are given the number of tasks, followed by the details of each task. Your output must indicate for each employee whether there exists an overlapping pair of tasks.
Formally, for any two consecutive tasks (after sorting in increasing order of start times) with times \( (s_1,e_1) \) and \( (s_2,e_2) \), an overlap occurs if \( s_2 < e_1 \) holds. Output "YES" if an overlap is found, otherwise output "NO".
inputFormat
The input is given via standard input (stdin) and adheres to the following format:
- The first line contains an integer \(T\) representing the number of test cases.
- For each test case:
- The first line contains an integer \(N\) denoting the number of employees.
- For each employee:
- The first line contains an integer \(k\) representing the number of tasks assigned to that employee.
- The next \(k\) lines each contain three space-separated integers: \(start\), \(end\), and \(id\). The task id can be ignored when determining overlaps.
outputFormat
For each test case, output one line. The line should contain \(N\) space-separated strings; each string corresponds to an employee and must be "YES" if the employee has overlapping tasks or "NO" otherwise.
## sample2
2
3
1 3 101
2 5 102
4 6 103
2
1 2 201
2 3 202
1
2
2 5 301
5 6 302
YES NO
NO
</p>