302573: CF497C. Distributing Parts

Memory Limit:0 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Gears

题意翻译

给出两个多边形A、B和两个点P、Q,使多边形A绕点P旋转,多边形B绕点Q旋转,问两者旋转方向与速度均相同时是否会在旋转过程中有交点 输入格式: 第一行两个整数x,y,表示P点的坐标 接下来一个整数n表示多边形A的点数 接下来n行,每行两个整数表示每个点的坐标 接下来两个整数表示Q点的坐标 接下来一个整数m表示多边形B的点数 接下来m行,每行两个整数表示每个点的坐标 输出格式: 一行一个字符串"YES"或"NO"表示是否会卡住 数据范围: 3<=n,m<=1000 -10000<=x<=10000

题目描述

There are two polygons on the plane, A and B. Polygon A rotates around point P, and polygon B rotates around point Q. Each polygon rotates with the constant rotational speed in the clockwise direction around its point, the rotational speed values of the polygons’ rotation are equal. Your task is to determine if there will be a collision between polygons. A collision is a situation when the polygons have at least one common point. It is guaranteed that at the moment 0 the polygons A and B do not intersect and no polygon is fully contained inside another one. Note that: - the polygons are not necessarily convex; - points P and Q can be located on the border of or outside their polygons.

输入输出格式

输入格式


The first line contains space-separated coordinates of point P. The second line contains a single integer n (3 ≤ n ≤ 1000) — the number of vertices of polygon A. Each of the next n lines contains two space-separated integers — the coordinates of the corresponding vertex of polygon A. The next line is empty. Then follow space-separated coordinates of point Q. The next line contains a single integer m (3 ≤ m ≤ 1000) — the number of vertices of polygon B. Next m lines contain the coordinates of the vertices of the polygon B. The vertices of both polygons are listed in the counterclockwise order. Coordinates of all points are integers, their absolute values don’t exceed $10^4$.

输出格式


Print “YES”, if the collision takes place and “NO” otherwise (don’t print the quotes).

输入输出样例

输入样例 #1

1 0
4
0 0
1 0
1 5
0 5
9 0
4
9 0
9 -5
10 -5
10 0

输出样例 #1

YES

输入样例 #2

0 0
3
1 0
2 -1
2 1
0 0
3
-1 0
-2 1
-2 -1

输出样例 #2

NO

说明

A polygon is a closed polyline that doesn’t intersect itself and doesn’t touch itself. Picture to the first sample: ![](https://cdn.luogu.com.cn/upload/pic/13594.png)

Input

题意翻译

给出两个多边形A、B和两个点P、Q,使多边形A绕点P旋转,多边形B绕点Q旋转,问两者旋转方向与速度均相同时是否会在旋转过程中有交点 输入格式: 第一行两个整数x,y,表示P点的坐标 接下来一个整数n表示多边形A的点数 接下来n行,每行两个整数表示每个点的坐标 接下来两个整数表示Q点的坐标 接下来一个整数m表示多边形B的点数 接下来m行,每行两个整数表示每个点的坐标 输出格式: 一行一个字符串"YES"或"NO"表示是否会卡住 数据范围: 3<=n,m<=1000 -10000<=x<=10000

加入题单

算法标签: