#P9241. Safe Aircraft Landing Scheduling

    ID: 22396 Type: Default 1000ms 256MiB

Safe Aircraft Landing Scheduling

Safe Aircraft Landing Scheduling

There are \(N\) airplanes preparing to land at an airport with a single runway. The \(i\)-th airplane arrives above the airport at time \(T_i\) with enough fuel to circle for an additional \(D_i\) time units. This means that the plane can begin landing at any time between \(T_i\) and \(T_i + D_i\) (inclusive). The landing process takes \(L_i\) time units.

When one airplane finishes landing, another airplane can immediately begin landing at the same time. However, a new landing cannot start before the previous landing has concluded.

Your task is to determine whether it is possible for all \(N\) airplanes to land safely under these conditions.

Note: All formulas are displayed in \(\LaTeX\) format.

inputFormat

The first line contains an integer \(N\) indicating the number of airplanes.

Each of the next \(N\) lines contains three space-separated integers \(T_i\), \(D_i\), and \(L_i\), where:

  • \(T_i\) is the time of arrival.
  • \(D_i\) is the additional time the airplane can wait (fuel limit).
  • \(L_i\) is the duration required for landing.

outputFormat

Output a single line: "Yes" if all airplanes can land safely, or "No" otherwise.

sample

3
1 3 2
2 2 1
3 2 2
Yes