eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Lawn mower

Lawn mower

The International Collegiate Soccer1 Competition (ICSC) is famous for its well-kept rectangular stadiums. The grass playing fields in ICSC stadiums are always \textbf{100} meters long, and \textbf{75} meters wide. 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. \includegraphics{https://static.e-olymp.com/content/54/54cc8a2b7c7bc65801f62a6bf33d382e3ec2369a.jpg} The ICSC has hired a new lawn-mower, Guido. Guido 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 ICSC, 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. \InputFile Each test case contains \textbf{3} lines. The first line contains two integers, \textbf{n_x} ( \textbf{0} < \textbf{n_x} < \textbf{1000}) and \textbf{n_y} ( \textbf{0} < \textbf{n_y} < \textbf{1000}), and a real number \textbf{w} (\textbf{0} < \textbf{w} ≤ \textbf{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 \textbf{n_x} real numbers \textbf{x_i} (\textbf{0} ≤ \textbf{x_i} ≤ \textbf{75}) describing the starting positions of the mower's center in Guido's end-to-end passes. The last line describes the side-to-side passes, with ny real numbers \textbf{y_i} (\textbf{0} ≤ \textbf{y_i} ≤ \textbf{100}). The end of the test cases is signalled with a line that contains the numbers "\textbf{0 0 0.0}". You should generate no output for this line, as it is not a test case. Real numbers for \textbf{w}, \textbf{x_i} and \textbf{y_i} can have up to \textbf{7} digits after the decimal point, and any cut will also include its boundaries. For example, if a \textbf{2.0}-meter wide cut is performed along the \textbf{10.0}-meter mark, then a strip of grass from \textbf{9.0} to \textbf{11.0 }(including both) will be considered "cut". \OutputFile Print "\textbf{YES}" if Guido has done a good job, or "\textbf{NO}" if some part of the field has not been mowed at least once when the mower was travelling along the length of the field, and again when it was travelling along the width.
Ліміт часу 1 секунда
Ліміт використання пам'яті 256 MiB
Вхідні дані #1
8 11 10.0
0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0
0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0
8 10 10.0
0.0 10.0 20.0 30.0 40.0 50.0 60.0 70.0
0.0 10.0 30.0 40.0 50.0 60.0 70.0 80.0 90.0 100.0
4 5 20.0
70.0 10.0 30.0 50.0
30.0 10.0 90.0 50.0 70.0
4 5 20.0
60.0 10.0 30.0 50.0
30.0 10.0 90.0 50.0 70.0
0 0 0.0
Вихідні дані #1
YES
NO
YES
NO