Furniture Factory
Time limit2sMemory limit128 MB
Decide if m workers can finish n preemptible jobs with release times and deadlines when each job takes at most one worker at a time.
Problem
A furniture factory employs workers in total. Every worker has exactly the same skill and productivity. Next month the factory must build pieces of furniture, and each piece comes with three values.
- : the earliest time at which work on it may begin
- : the total amount of work needed to finish it
- : the deadline by which it must be finished ()
In other words, piece can only be worked on from time onward, it is complete once units of work have been spent on it, and it must be finished no later than time .
At any moment at most one worker may work on a given piece of furniture. Work may be paused and resumed later, and a paused piece may be picked up by a different worker. Every worker starts and stops on integer times, and time is written as for convenience.
Determine whether a production plan exists that finishes every piece of furniture by its own deadline.
Input
The first line contains the number of test cases . For each test case, the first line contains the number of workers and the number of pieces (, ). The next lines each contain , , for one piece (, ).
Output
For each test case, print one line: Yes if a production plan finishes every piece of furniture by its deadline, and No otherwise.