Problem D
Moving Day
It’s that time of the year when students head back to school, which will usually involve moving lots of stuff, and packing lots of that stuff into boxes. However, before we go through that effort, it would be nice to know whether the boxes we have are the right size!
A box has three dimensions,
So, we want to answer a simple question: given multiple
boxes, is the largest box (by volume) large enough to
store all our items? For example, suppose
On the other hand, suppose
Input
The input specifies a set of boxes. It begins with a line
containing two integers:
Output
The output is a single integer: the value of
Sample Input 1 | Sample Output 1 |
---|---|
3 10 1 1 2 2 2 2 3 2 1 |
-2 |
Sample Input 2 | Sample Output 2 |
---|---|
3 30 1 1 1 5 2 3 5 2 1 |
0 |
Sample Input 3 | Sample Output 3 |
---|---|
4 980 10 10 10 10 5 2 5 3 2 90 5 2 |
20 |