Score : $400$ points
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$.
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$
If we can match $S$ with $T$, 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 $S$ and $T$ are painted red and green, respectively:
In this case, we can match $S$ with $T$ as follows:
3 1 0 1 1 3 0 -1 0 -1 1 -3 0
No
The figure below shows the given sets of points:
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.
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