No.1944 ∞
Problem Statement
You have $N$ circles numbered from $1$ to $N$. The radii of the circles are $R_1, R_2, \ldots, R_N$, respectively.
You can place the circles you have on the xy-plane in any order. Determine whether it is possible to place them as follows.
- Place one circle centered at the origin.
- Place each circle from the $2$nd onward so that it has a common point with the circle placed immediately before it.※
- The circle placed $N$th touches the coordinates $(X,Y)$. ※ However, when placing a circle with the same radius as the previous circle, placing it so that the two coincide completely also counts as having a common point.
Input
$N\ X\ Y$ $R_1$ $R_2$ $\ldots$ $R_N$
Constraints
- $ 1 \le N \le 2\times10^{5}$
- $ -10^9 \le X,Y \le 10^9$
- $ 1 \le R_i \le 10^5$
- All inputs are integers.
Output
Print Yes if the circles can be placed so that the circle placed $N$th touches the coordinates $(X,Y)$, and No otherwise.
Print a newline at the end.
Sample
Sample 1
Input
4 8 3 1 2 3 1
Output
Yes
For example, the following placement is possible.
Sample 2
Input
3 100 0 3 4 2
Output
No
No matter how the circles are placed, the circle placed $3$rd can never touch $(100,0)$.
Sample 3
Input
3 -1 -2 1 1 5
Output
Yes
For example, the following placement is possible.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
H20
蜜蜂
Kazun