Geometry
Geometry-13
Geometry-14
Geometry-15
~/algor $ cat problems/markaziy-simmetrik
Centrally symmetric?
Medium
1000 ms
128 MB
58%
$n$ points are given on the plane (some may coincide). Is there a point $O$ on the plane such that rotating the set by $180^{\circ}$ around $O$ maps it onto itself (every point lands on a point of the set, and the multiplicities of coinciding points are preserved)? The coordinates of $O$ need not be integers. If so, print YES, otherwise print NO.
Input
The first line contains a positive integer $n$. Each of the next $n$ lines contains two integers: $x_{i}$ and $y_{i}$.
Output
YES or NO.
Note
$1 \le n \le 10^{5}$
$-10^{9} \le x_{i}, y_{i} \le 10^{9}$
Examples
Input #1
5 0 0 2 1 -2 -1 3 -2 -3 2
Output #1
YES
Input #2
3 0 0 1 0 0 1
Output #2
NO