#P9241. [蓝桥杯 2023 省 B] 飞机降落
[蓝桥杯 2023 省 B] 飞机降落
Problem Description
There are airplanes preparing to land at an airport with only one runway. For airplane , it arrives above the airport at time . When it arrives, its remaining fuel allows it to keep circling for another units of time. That is, it can start landing as early as time , and as late as time . The landing process takes units of time.
When one airplane finishes landing, another airplane may start landing immediately at the same moment. However, no airplane may start landing before the previous airplane has finished landing.
Determine whether all airplanes can land safely.
Input Format
The input contains multiple test cases.
The first line contains an integer , representing the number of test cases.
For each test case, the first line contains an integer .
The following lines each contain three integers .
Output Format
For each test case, output YES or NO, indicating whether all airplanes can land safely.
2
3
0 100 10
10 10 10
0 2 20
3
0 10 20
10 10 20
20 10 20
YES
NO
Hint
Sample Explanation
For the first test case, you can schedule airplane 3 to start landing at time 0 and finish at time 20. Schedule airplane 2 to start landing at time 20 and finish at time 30. Schedule airplane 1 to start landing at time 30 and finish at time 40.
For the second test case, no matter how you schedule, there will always be an airplane that cannot land in time.
Constraints and Notes
For of the testdata, .
For of the testdata, , , .
Lanqiao Cup 2023 Provincial Contest B Group Problem D.
Translated by ChatGPT 5