#K4291. Taco Box Fitting
Taco Box Fitting
Taco Box Fitting
You are given a sorting machine that can only accommodate boxes whose dimensions, when arranged in non-decreasing order, do not exceed the machine's limits.
Specifically, you are provided with a machine that has three maximum permitted dimensions W, L, and H. For each box, given by its three dimensions, you must sort its dimensions in ascending order. If the smallest dimension is at most W, the middle dimension is at most L, and the largest is at most H, then the box can fit through the machine; otherwise, it cannot.
The comparison is performed as follows. Let the sorted dimensions of a box be \(d_1 \le d_2 \le d_3\). The box can pass if and only if \(d_1 \le W\), \(d_2 \le L\), and \(d_3 \le H\).
Your task is to determine, for each box, whether it can pass through the machine.
inputFormat
The input is given from standard input (stdin) and has the following format:
T W L H x11 x12 x13 x21 x22 x23 ... xT1 xT2 xT3
Where:
T
is the number of boxes.W, L, H
are the maximum allowed dimensions for the smallest, middle, and largest dimensions respectively.- Each of the next
T
lines contains three integers representing the dimensions of a box.
outputFormat
For each box, output a single line with YES
if the box fits in the machine and NO
otherwise. The output should be printed to standard output (stdout).
3 5 10 8
4 5 6
10 5 4
11 5 10
YES
YES
NO
</p>