#P6320. Matchsticks in a Rectangle Box
Matchsticks in a Rectangle Box
Matchsticks in a Rectangle Box
Mirko has n matchsticks and a rectangular box of size w × h. He intends to place each matchstick inside the box. A matchstick can be placed if its entire length can fit inside the box when oriented optimally.
Since the box is considered as a plane, the maximum length that can be placed inside the box is determined by the diagonal length, given by \(\sqrt{w^2+h^2}\). For each matchstick, if its length is less than or equal to \(\sqrt{w^2+h^2}\), then it can be placed in the box.
Your task is to determine for each matchstick, whether it can be placed inside the box.
inputFormat
The first line contains three integers n, w, and h where:
- n is the number of matchsticks,
- w and h represent the width and height of the box respectively.
Then follow n lines, each containing one integer representing the length of a matchstick.
outputFormat
For each matchstick, output a line containing YES
if the matchstick can be placed inside the box (i.e. if its length is less than or equal to \(\sqrt{w^2+h^2}\)), otherwise output NO
.
sample
3 4 5
3
5
7
YES
YES
NO
</p>