Lawn Mower

0

0 votes
Problem

Noddy, here at Technology Students' Gymkhana has bought a brand new Lawn-Mower for the fields of Tata Sports Complex. The grass is mowed every week with special lawn mowers, always using the same strategy: first, they make a series of passes along the length of the field, and then they do the same along the width of the field. All passes are straight lines, parallel to the sides of the field. But Noddy is very chaotic, and instead of covering the field incrementally, he likes to choose random starting positions for each of his passes. But he is afraid of not doing a good job and being fired by the President of the Gymkhana, so he has asked you to help him. Write a program to make sure that the grass in the field is perfectly cut: all parts of the field have to be mowed at least once when the mower goes from end to end, and again when the mower goes from side to side. The grass playing fields in Tata Sports Complex are 100 meters long, and 75 meters wide.
Smiley face Smiley face

Input Format
Each test case contains 3 lines.
The first line contains two integers, M (0 < M < 1000) and N (0 < N < 1000), and a real number W (0 < W < 50), which represents the width of the cut of that particular lawn mower. The next line describes the end-to-end passes (along the length of the field), and contains M real numbers Xi (0 < Xi < 75) describing the starting positions of the mower's center in Noddy's end-to-end passes. The last line describes the side-to-side passes, with N real numbers Yi (0 < Yi < 100).
The end of the All the test cases is signaled with a line that contains the numbers 0 0 0.0 . You should generate no output for this line, as it is not a test case.
Real numbers for w, Xi and Yi can have up to 7 digits after the decimal point, and any cut will also include its boundaries.
For example, if a 2.0-meter wide cut is performed along the 10.0-meter mark, then a strip of grass from 9.0 to 11.0 (including both) will be considered "cut".

Output Format
For each test case Print a single line containing YES if Noddy has done a good job, or NO if some part of the field has not been Mowed at all,when the mower was travelling along the length of the field, and again when it was travelling along the width.

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?