AtCoder Beginner Contest 207
D
Congruence Points
AtCoder
⌀ 2074
原题
← CE →
翻译中…

Problem Statement

翻译中…

You are given two sets $S=\{(a_1,b_1),(a_2,b_2),\ldots,(a_N,b_N)\}$ and $T=\{(c_1,d_1),(c_2,d_2),\ldots,(c_N,d_N)\}$ of $N$ points each on a two-dimensional plane.

翻译中…

Determine whether it is possible to do the following operations on $S$ any number of times (possibly zero) in any order so that $S$ matches $T$.

翻译中…
  • Choose a real number $p\ (0 \lt p \lt 360)$ and rotate every point in $S$ $p$ degrees clockwise about the origin.
  • Choose real numbers $q$ and $r$ and move every point in $S$ by $q$ in the $x$-direction and by $r$ in the $y$-direction. Here, $q$ and $r$ can be any real numbers, be it positive, negative, or zero.
翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 100$
  • $-10 \leq a_i,b_i,c_i,d_i \leq 10$
  • $(a_i,b_i) \neq (a_j,b_j)$ if $i \neq j$.
  • $(c_i,d_i) \neq (c_j,d_j)$ if $i \neq j$.
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
a_1 b_1
a_2 b_2
\hspace{0.6cm}\vdots
a_N b_N
c_1 d_1
c_2 d_2
\hspace{0.6cm}\vdots
c_N d_N

翻译中…

Output

翻译中…

If we can match $S$ with $T$, print Yes; otherwise, print No.

翻译中…

样例

Input #1
3
0 0
0 1
1 0
2 0
3 0
3 1
Output #1
Yes
The figure below shows the given sets of points, where the points in $S$ and $T$ are painted red and green, respectively: ![image](https://img.atcoder.jp/ghi/39ad67d4e10490f509f252a1f0e4935b.png) In this case, we can match $S$ with $T$ as follows: 1. Rotate every point in $S$ $270$ degrees clockwise about the origin. 2. Move every point in $S$ by $3$ in the $x$-direction and by $0$ in the $y$-direction.
Input #2
3
1 0
1 1
3 0
-1 0
-1 1
-3 0
Output #2
No
The figure below shows the given sets of points: ![image](https://img.atcoder.jp/ghi/02c4ca4a8329110dc131b37720283d2a.png) Although $S$ and $T$ are symmetric about the $y$-axis, we cannot match $S$ with $T$ by rotations and translations as stated in Problem Statement.
Input #3
4
0 0
2 9
10 -2
-6 -7
0 0
2 9
10 -2
-6 -7
Output #3
Yes
Input #4
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
Output #4
Yes
题目信息
题号
abc207_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。