#K47687. Attend All Events
Attend All Events
Attend All Events
You are given several test cases. In each test case, you are provided with a list of events represented by their start times. Each event's start time is given as two integers: the hour and the minute. Alex wants to attend all the events, but he cannot attend two events that start at the exact same time. Your task is to determine, for every test case, whether Alex can attend all events (i.e. all start times are distinct).
Mathematically, if an event starts at time \( (h, m) \), you can convert it to minutes as follows:
[ \text{time in minutes} = h \times 60 + m ]
If any two events have the same value, Alex can not attend all events.
inputFormat
The input is read from standard input (stdin) and is formatted as follows:
T n h1 m1 h2 m2 ... hn mn ... (repeated T times)
Where:
- T is an integer representing the number of test cases.
- For each test case, the first line contains an integer n, the number of events.
- Each of the next n lines contains two integers h (hour) and m (minute), representing the start time of an event.
outputFormat
For each test case, output a single line. Print YES
if all events have distinct start times, or NO
if there is any conflict (i.e. at least two events share the same start time).
1
3
10 30
12 45
17 15
YES
</p>