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

Pachinko

Pachinko

The game of Pachinko has been all the rage in Japan for nearly a century. The game is played by shooting a metal ball into a special gaming device, depicted below. The ball then falls from somewhere at the top of the board, bouncing against a series of obstacles on its way down. If the player is lucky, the ball goes into one of the pockets, and additional balls are released as a jackpot. Otherwise, the ball is lost (and the game as well). \includegraphics{https://static.e-olymp.com/content/0e/0e5a50343a5d776af8e4207ddba259894ecdd65f.jpg} In the Pachinko parlour I Control the Physics Core, the machine boards are rectangular, and the player can drop the ball from any point at a height of \textbf{100} centimetres, corresponding to points with cartesian coordinates (\textbf{x}, \textbf{100}), where \textbf{-100} < \textbf{x} < \textbf{100}. Obstacles are segments de ned by the coordinates of their endpoints. There are neither horizontal nor zero-length obstacles, and they do not intersect one another. For our purposes, we can assume that the ball is a point with no thickness, and we ignore issues of friction, inertia or ricochets. In particular, we can disregard the horizontal displacement of the ball during falls. There is only one jackpot pocket, located at the bottom of the board, between coordinates (\textbf{-10}, \textbf{0}) and (\textbf{10}, \textbf{0}). If the ball falls exactly in one of the endpoints, we consider that it hits the jackpot; and if a ball falls exactly into one of the endpoints of a segment, it rolls on that segment, rather than falling through. Some of the machines at the ICPC parlour have long been suspected of being rigged, as rumour has it that nobody has ever hit the jackpot. A neutral committee has therefore been appointed to verify or refute this claim. As a member, you have taken part in discussions and game trials, all of which have been inconclusive. Much as you enjoyed playing the game for free, after enduring several of the endless meetings you decide it is about time the matter was settled once and for all. To this end, you have taken on the task of writing a program to determine whether the jackpot is reachable or not, based on the speci cations of the Pachinko device. \InputFile Your program will be tested on one or more machines. The description of each machine starts with an integer \textbf{n} (\textbf{0} ≤ \textbf{n }≤ \textbf{500}), indicating the number of segments in it. Each of the following \textbf{n} lines describes a segment by giving \textbf{4} real numbers \textbf{x y x_0 y_0}, representing the coordinates (\textbf{x}, \textbf{y}) and (\textbf{x_0}, \textbf{y_0}) of each of its endpoints, where \textbf{-100} < \textbf{x} < \textbf{x_0} < \textbf{100}, \textbf{0} < \textbf{y} < \textbf{100}, \textbf{0} < \textbf{y_0} < \textbf{100}, \textbf{y} ≠ \textbf{y_0}. No two segments intersect. A blank line follows each case. The last line of input contains \textbf{-1}. \OutputFile For each machine, answer \textbf{yes} if the jackpot is reachable and \textbf{no} otherwise. \includegraphics{https://static.e-olymp.com/content/63/63a9f8d71638fb8861bad998792ced7ea611de29.jpg}
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
2
-20 60 20 85
-20 35 10 5

2
-5 50 -20 25
5 50 20 25

7
-20 80 -10 75
-15 65 5 70
15 75 25 80
-5 65 10 45
-20 55 -5 40
-15 20 10 35
15 30 25 20

-1
Вихідні дані #1
yes
yes
no