CF166B.Polygons
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You've got another geometrical task. You are given two non-degenerate polygons A and B as vertex coordinates. Polygon A is strictly convex. Polygon B is an arbitrary polygon without any self-intersections and self-touches. The vertices of both polygons are given in the clockwise order. For each polygon no three consecutively following vertices are located on the same straight line.
Your task is to check whether polygon B is positioned strictly inside polygon A. It means that any point of polygon B should be strictly inside polygon A. "Strictly" means that the vertex of polygon B cannot lie on the side of the polygon A.
你遇到了另一个几何问题。给定两个非退化多边形 A 和 B,以顶点坐标形式给出。多边形 A 是严格凸的;多边形 B 是任意简单多边形(无自交、无自接触)。两个多边形的顶点均按顺时针顺序给出。对于每个多边形,任意三个连续顶点均不共线。
你的任务是判断多边形 B 是否严格位于多边形 A 的内部。即:多边形 B 的任意一点都必须严格位于多边形 A 的内部。“严格”意味着多边形 B 的任一顶点均不能落在多边形 A 的任意一条边上。
输入格式
The first line contains the only integer n (3 ≤ n ≤ 105) — the number of vertices of polygon A. Then n lines contain pairs of integers x__i, y__i (|x__i|, |y__i| ≤ 109) — coordinates of the i-th vertex of polygon A. The vertices are given in the clockwise order.
The next line contains a single integer m (3 ≤ m ≤ 2·104) — the number of vertices of polygon B. Then following m lines contain pairs of integers x__j, y__j (|x__j|, |y__j| ≤ 109) — the coordinates of the j-th vertex of polygon B. The vertices are given in the clockwise order.
The coordinates of the polygon's vertices are separated by a single space. It is guaranteed that polygons A and B are non-degenerate, that polygon A is strictly convex, that polygon B has no self-intersections and self-touches and also for each polygon no three consecutively following vertices are located on the same straight line.
第一行包含唯一一个整数 n(3≤n≤105)—— 多边形 A 的顶点数。接下来 n 行,每行包含一对整数 xi,yi(∣xi∣,∣yi∣≤109)—— 多边形 A 第 i 个顶点的坐标。顶点按顺时针顺序给出。
接下来一行包含一个整数 m(3≤m≤2⋅104)—— 多边形 B 的顶点数。随后 m 行,每行包含一对整数 xj,yj(∣xj∣,∣yj∣≤109)—— 多边形 B 第 j 个顶点的坐标。顶点按顺时针顺序给出。
多边形各顶点的坐标由单个空格分隔。保证多边形 A 和 B 均为非退化多边形,多边形 A 是严格凸的,多边形 B 无自交与自接触,并且对每个多边形而言,任意三个连续顶点均不共线。
输出格式
Print on the only line the answer to the problem — if polygon B is strictly inside polygon A, print "YES", otherwise print "NO" (without the quotes).
在唯一的一行上输出该问题的答案:如果多边形 B 严格位于多边形 A 的内部,则输出 "YES",否则输出 "NO"(不带引号)。
输入输出样例
输入#1
6 -2 1 0 3 3 3 4 1 3 -2 2 -2 4 0 1 2 2 3 1 1 0
输出#1
YES
输入#2
5 1 2 4 2 3 -3 -2 -2 -2 1 4 0 1 1 2 4 1 2 -1
输出#2
NO
输入#3
5 -1 2 2 3 4 1 3 -2 0 -3 5 1 0 1 1 3 1 5 -1 2 -1
输出#3
NO
输入解题思路,AI测评打分。不知道怎么写?