#abc251g. G - Intersection of Polygons
G - Intersection of Polygons
Score : points
问题描述
在一个 平面上,一个凸 边形 的顶点按 逆时针 方向给出为 、、、。此处, 轴的正方向是向右,而 轴的正方向是向上。
根据这个多边形 ,我们考虑 个凸 边形 、、、。对于 ,多边形 是通过将 在 轴正方向上平移 ,在 轴正方向上平移 得到的。换句话说, 是一个凸 边形,其顶点坐标分别为 、、、。
对于 个点 、、、,确定每个点是否“被所有这 个多边形 、、、 包含”。
这里,我们将点位于多边形边界上也视为该点被包含在多边形内。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
The vertices of a convex -gon in an -plane are given as in the counterclockwise order. (Here, the positive direction of the -axis is right, and the positive direction of the -axis is up.)
Based on this polygon , we consider convex -gons .
For , the polygon is obtained by shifting in the positive direction of the -axis by and in the positive direction of the -axis by . In other words, is a convex -gon whose vertices are $(x_1+u_i, y_1+v_i), (x_2+u_i, y_2+v_i), \ldots, (x_N+u_i, y_N+v_i)$.
For each of points , determine if "the point is contained in all of the polygons ."
Here, we regard a point is also contained in a polygon if the point is on the polygon's boundary.
Constraints
- All values in input are integers.
- forms a convex -gon in the counterclockwise order.
- Each interior angle of the polygon is less than degrees.
Input
Input is given from Standard Input in the following format:
Output
Print lines. For , the -th line should contain Yes
if point is contained in all of the polygons ; it should contain No
otherwise.
Sample Input 1
5
-2 -3
0 -2
1 0
0 2
-2 1
2
0 1
1 0
6
0 0
1 0
0 1
1 1
-1 -1
-1 -2
Sample Output 1
Yes
No
Yes
Yes
Yes
No
Polygon is a pentagon (-gon) whose vertices are .
- Polygon is a pentagon (-gon) obtained by shifting in the positive direction of the -axis by and in the positive direction of the -axis by , so its vertices are .
- Polygon is a pentagon (-gon) obtained by shifting in the positive direction of the -axis by and in the positive direction of the -axis by , so its vertices are .
Thus, the following lines should be printed.
- The -st line should be
Yes
because is contained in both and . - The -nd line should be
No
because is contained in but not in . - The -rd line should be
Yes
because is contained in both and . - The -th line should be
Yes
because is contained in both and . - The -th line should be
Yes
because is contained in both and . - The -th line should be
No
because is contained in but not in .
Note that a point on the boundary of a polygon is also considered to be contained in the polygon.
Sample Input 2
10
45 100
-60 98
-95 62
-95 28
-78 -41
-54 -92
-8 -99
87 -94
98 23
87 91
5
-57 -40
-21 -67
25 39
-30 25
39 -20
16
4 5
-34 -8
-63 53
78 84
19 -16
64 9
-13 7
13 53
-20 4
2 -7
3 18
-12 10
-69 -93
2 9
27 64
-92 -100
Sample Output 2
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
No
update @ 2024/3/10 10:44:18