#C6499. Meeting Request Scheduling
Meeting Request Scheduling
Meeting Request Scheduling
You are given n engineers and m meeting requests. Each meeting request is represented by three integers: the start time, the end time, and the engineer ID responsible for the meeting. Two meetings assigned to the same engineer conflict if the start time of a meeting is strictly less than the end time of the previous meeting when meetings are sorted by their start times.
Your task is to determine if it is possible to schedule all meeting requests without any conflicts for any engineer. If the schedule can be arranged without conflicts, print YES
; otherwise, print NO
.
Note: Meetings for different engineers may overlap without conflict.
The input is given via stdin
and the result should be printed to stdout
.
inputFormat
The first line contains two integers n and m, where n is the number of engineers and m is the number of meeting requests.
The next m lines each contain three integers s, e, and id representing the start time, end time, and the engineer's ID for each meeting request.
It is guaranteed that if m is zero, then no additional lines follow.
outputFormat
Output a single line with YES
if all meeting requests can be scheduled without conflicts, or NO
if there is any conflict for an engineer.
1 2
1 3 1
4 6 1
YES
</p>