CF1299B.Aerodynamic

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Guy-Manuel and Thomas are going to build a polygon spaceship.

You're given a strictly convex (i. e. no three points are collinear) polygon PP which is defined by coordinates of its vertices. Define P(x,y)P(x,y) as a polygon obtained by translating PP by vector (x,y)\overrightarrow {(x,y)} . The picture below depicts an example of the translation:

Define TT as a set of points which is the union of all P(x,y)P(x,y) such that the origin (0,0)(0,0) lies in P(x,y)P(x,y) (both strictly inside and on the boundary). There is also an equivalent definition: a point (x,y)(x,y) lies in TT only if there are two points A,BA,B in PP such that AB=(x,y)\overrightarrow {AB} = \overrightarrow {(x,y)} . One can prove TT is a polygon too. For example, if PP is a regular triangle then TT is a regular hexagon. At the picture below PP is drawn in black and some P(x,y)P(x,y) which contain the origin are drawn in colored:

The spaceship has the best aerodynamic performance if PP and TT are similar. Your task is to check whether the polygons PP and TT are similar.

输入格式

The first line of input will contain a single integer nn ( 3n1053 \le n \le 10^5 ) — the number of points.

The ii -th of the next nn lines contains two integers xi,yix_i, y_i ( xi,yi109|x_i|, |y_i| \le 10^9 ), denoting the coordinates of the ii -th vertex.

It is guaranteed that these points are listed in counterclockwise order and these points form a strictly convex polygon.

输出格式

Output "YES" in a separate line, if PP and TT are similar. Otherwise, output "NO" in a separate line. You can print each letter in any case (upper or lower).

输入输出样例

  • 输入#1

    4
    1 0
    4 1
    3 4
    0 3

    输出#1

    YES
  • 输入#2

    3
    100 86
    50 0
    150 0

    输出#2

    nO
  • 输入#3

    8
    0 0
    1 0
    2 1
    3 3
    4 6
    3 6
    2 5
    1 3

    输出#3

    YES

说明/提示

The following image shows the first sample: both PP and TT are squares. The second sample was shown in the statements.

首页