A13201 | Aerodynamic
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $P$ which is defined by coordinates of its vertices. Define $P(x,y)$ as a polygon obtained by translating $P$ by vector $\overrightarrow {(x,y)}$ . The picture below depicts an example of the translation:

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

The spaceship has the best aerodynamic performance if $P$ and $T$ are similar. Your task is to check whether the polygons $P$ and $T$ are [similar](https://tinyurl.com/vp5m7vl).
You're given a strictly convex (i. e. no three points are collinear) polygon $P$ which is defined by coordinates of its vertices. Define $P(x,y)$ as a polygon obtained by translating $P$ by vector $\overrightarrow {(x,y)}$ . The picture below depicts an example of the translation:

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

The spaceship has the best aerodynamic performance if $P$ and $T$ are similar. Your task is to check whether the polygons $P$ and $T$ are [similar](https://tinyurl.com/vp5m7vl).
输入格式
The first line of input will contain a single integer $n$ ( $3 \le n \le 10^5$ ) — the number of points.
The $i$ -th of the next $n$ lines contains two integers $x_i, y_i$ ( $|x_i|, |y_i| \le 10^9$ ), denoting the coordinates of the $i$ -th vertex.
It is guaranteed that these points are listed in counterclockwise order and these points form a strictly convex polygon.
The $i$ -th of the next $n$ lines contains two integers $x_i, y_i$ ( $|x_i|, |y_i| \le 10^9$ ), denoting the coordinates of the $i$ -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 $P$ and $T$ 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 $P$ and $T$ are squares. The second sample was shown in the statements.


C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted