atcoder#ABC274D. [ABC274D] Robot Arms 2
[ABC274D] Robot Arms 2
Score : points
Problem Statement
You are given a sequence of length consisting of positive integers, and integers and . Determine whether it is possible to place points in the -coordinate plane to satisfy all of the following conditions. (It is allowed to place two or more points at the same coordinates.)
- .
- .
- .
- The distance between the points and is . ()
- The segments and form a degree angle. ()
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
If it is possible to place to satisfy all of the conditions in the Problem Statement, print Yes
; otherwise, print No
.
3 -1 1
2 1 3
Yes
The figure below shows a placement where , , , and . All conditions in the Problem Statement are satisfied.
5 2 0
2 2 2 2 2
Yes
Letting , , , , , and satisfies all the conditions. Note that multiple points may be placed at the same coordinates.
4 5 5
1 2 3 4
No
3 2 7
2 7 4
No
10 8 -7
6 10 4 1 5 9 8 6 5 1
Yes