atcoder#ABC207D. [ABC207D] Congruence Points
[ABC207D] Congruence Points
Score : points
Problem Statement
You are given two sets and of points each on a two-dimensional plane.
Determine whether it is possible to do the following operations on any number of times (possibly zero) in any order so that matches .
- Choose a real number and rotate every point in degrees clockwise about the origin.
- Choose real numbers and and move every point in by in the -direction and by in the -direction. Here, and can be any real numbers, be it positive, negative, or zero.
Constraints
- if .
- if .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
If we can match with , print Yes
; otherwise, print No
.
3
0 0
0 1
1 0
2 0
3 0
3 1
Yes
The figure below shows the given sets of points, where the points in and are painted red and green, respectively:
In this case, we can match with as follows:
- Rotate every point in degrees clockwise about the origin.
- Move every point in by in the -direction and by in the -direction.
3
1 0
1 1
3 0
-1 0
-1 1
-3 0
No
The figure below shows the given sets of points:
Although and are symmetric about the -axis, we cannot match with by rotations and translations as stated in Problem Statement.
4
0 0
2 9
10 -2
-6 -7
0 0
2 9
10 -2
-6 -7
Yes
6
10 5
-9 3
1 -5
-6 -5
6 9
-9 0
-7 -10
-10 -5
5 4
9 0
0 -10
-10 -2
Yes