#C11741. Overlapping Scheduled Posts
Overlapping Scheduled Posts
Overlapping Scheduled Posts
You are given a list of scheduled posts by various users. Each post is defined by a user ID and a time interval [start, end]. Two posts by the same user are considered overlapping if the end time of one post is not less than the start time of the next post, i.e., $$a_{end} \geq b_{start}$$. For each test case, determine whether there exists at least one pair of overlapping posts for any user. Print "YES" if there is an overlap and "NO" otherwise.
inputFormat
The first line contains an integer $$T$$, the number of test cases. For each test case, the first line contains an integer $$N$$, the number of posts. This is followed by $$N$$ lines, each containing three space‐separated integers: the user ID, the start time, and the end time of a post.
outputFormat
For each test case, output a single line containing either "YES" if there is at least one pair of overlapping posts for any user, or "NO" if there is none.## sample
2
4
1 1 5
1 6 10
2 2 7
2 5 8
3
3 1 3
3 4 6
3 2 5
YES
YES
</p>