#K12641. Task Scheduling with Time Windows

    ID: 23736 Type: Default 1000ms 256MiB

Task Scheduling with Time Windows

Task Scheduling with Time Windows

You are given multiple test cases. In each test case, there are n tasks that must be completed in the given order. The i-th task requires $t_i$ units of time and must be started within a time window. The task can only start at or after time $l_i$ and must begin no later than time $r_i - t_i$, ensuring that it completes by time $r_i$.

Your job is to determine for each test case if it is possible to complete all tasks sequentially while respecting their time windows. If it is possible, output "Yes"; otherwise, output "No".

Note: Tasks must be executed in the given order, and the next task does not start until the previous one is finished.

inputFormat

The input is read from standard input (stdin) and has the following format:

T
n
t₁ l₁ r₁
...
tₙ lₙ rₙ
... (repeated for each test case)

Where:

  • T is the number of test cases.
  • For each test case, n is the number of tasks.
  • Each of the next n lines contains three integers representing tᵢ, lᵢ, and rᵢ respectively.

outputFormat

For each test case, print a single line containing either "Yes" if it is possible to complete all tasks within their respective time windows, or "No" otherwise. The output is written to standard output (stdout).

## sample
1
1
5 1 10
Yes

</p>