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

Sky Jump

Sky Jump

Dr. Kay Em, a genius scientist, developed a new missile named "Ikan-no-i." This missile has \textbf{N} jet engines. When the \textbf{i}-th engine is ignited, the missile's velocity changes to (\textbf{vx_i}, \textbf{vy_i}) immediately. Your task is to determine whether the missile can reach the given target point (\textbf{X}, \textbf{Y}). The missile can be considered as a mass point in a two-dimensional plane with the \textbf{y}-axis pointing up, a ected by the gravity of \textbf{9.8} downward (i.e. the negative \textbf{y}-direction) and initially set at the origin (\textbf{0}, \textbf{0}). The engines can be ignited at any time in any order. Still, note that at least one of them needs to be ignited to get the missile launched. \InputFile The input consists of multiple datasets. Each dataset has the following format. \textbf{N vx_1 vy_1 vx_2 vy_2 ... vx_N vy_N X Y} All values are integers and meet the following constraints: \textbf{1} ≤ \textbf{N} ≤ \textbf{1000}, \textbf{0} < \textbf{vx_i} ≤ \textbf{1000}, \textbf{-1000} ≤ \textbf{vy_i} ≤ \textbf{1000}, \textbf{0} < \textbf{X} ≤ \textbf{1000}, \textbf{-1000} ≤ \textbf{Y} ≤ \textbf{1000}. The end of input is indicated by a line with a single zero. \OutputFile For each dataset, output whether the missile can reach the target point in a line: "\textbf{Yes}" if it can, "\textbf{No}" otherwise.
Лимит времени 30 секунд
Лимит использования памяти 256 MiB
Входные данные #1
1
1 1
10 -480
2
6 7
5 5
4 1
3
10 5
4 4
8 4
2 0
0
Выходные данные #1
Yes
Yes
No
Источник ACM International Collegiate Programming Contest JAG Practice Contest, Tokyo, 2011-11-06