CF717I.Cowboy Beblop at his computer
省选/NOI-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Cowboy Beblop is a funny little boy who likes sitting at his computer. He somehow obtained two elastic hoops in the shape of 2D polygons, which are not necessarily convex. Since there's no gravity on his spaceship, the hoops are standing still in the air. Since the hoops are very elastic, Cowboy Beblop can stretch, rotate, translate or shorten their edges as much as he wants.
For both hoops, you are given the number of their vertices, as well as the position of each vertex, defined by the X , Y and Z coordinates. The vertices are given in the order they're connected: the 1st vertex is connected to the 2nd, which is connected to the 3rd, etc., and the last vertex is connected to the first one. Two hoops are connected if it's impossible to pull them to infinity in different directions by manipulating their edges, without having their edges or vertices intersect at any point – just like when two links of a chain are connected. The polygons' edges do not intersect or overlap.
To make things easier, we say that two polygons are well-connected, if the edges of one polygon cross the area of the other polygon in two different directions (from the upper and lower sides of the plane defined by that polygon) a different number of times.
Cowboy Beblop is fascinated with the hoops he has obtained and he would like to know whether they are well-connected or not. Since he’s busy playing with his dog, Zwei, he’d like you to figure it out for him. He promised you some sweets if you help him!
牛仔贝布洛普是一个有趣的小男孩,喜欢坐在电脑前。他不知怎么弄到了两个呈二维多边形形状的弹性圆环,这些多边形不一定是凸的。由于他的宇宙飞船上没有重力,这两个圆环静止地悬浮在空中。又因为圆环非常有弹性,牛仔贝布洛普可以任意拉伸、旋转、平移或缩短它们的边。
对于每个圆环,你将获得其顶点数量,以及每个顶点的位置(由 X、Y 和 Z 坐标定义)。顶点按连接顺序给出:第 1 个顶点连接到第 2 个顶点,第 2 个顶点连接到第 3 个顶点,依此类推,最后一个顶点再连接回第一个顶点。两个圆环是连通的,当且仅当无法通过操纵它们的边,使它们朝不同方向被拉至无穷远处,而不导致任何边或顶点相交——这类似于链条中两个链节相互连接的情形。多边形的边彼此不相交也不重叠。
为简化问题,我们定义:若一个多边形的边以不同方向(即分别从另一多边形所在平面的上方和下方)穿过另一多边形所围成的区域的次数不相等,则称这两个多边形是良好连通的(well-connected)。
牛仔贝布洛普对他得到的圆环十分着迷,他想知道这两个圆环是否是良好连通的。由于他正忙着和他的狗“兹维”玩耍,他希望你能帮他解决这个问题。作为回报,他答应请你吃糖果!
输入格式
The first line of input contains an integer n (3 ≤ n ≤ 100 000), which denotes the number of edges of the first polygon. The next N lines each contain the integers x, y and z ( - 1 000 000 ≤ x, y, z ≤ 1 000 000) — coordinates of the vertices, in the manner mentioned above. The next line contains an integer m (3 ≤ m ≤ 100 000) , denoting the number of edges of the second polygon, followed by m lines containing the coordinates of the second polygon’s vertices.
It is guaranteed that both polygons are simple (no self-intersections), and in general that the obtained polygonal lines do not intersect each other. Also, you can assume that no 3 consecutive points of a polygon lie on the same line.
输入的第一行包含一个整数 n(3≤n≤100000),表示第一个多边形的边数。接下来的 n 行每行包含三个整数 x、y 和 z(−1000000≤x,y,z≤1000000),即顶点的坐标,顺序如上所述。下一行包含一个整数 m(3≤m≤100000),表示第二个多边形的边数,随后是 m 行,每行包含第二个多边形各顶点的坐标。
保证两个多边形均为简单多边形(无自交),且通常情况下所得的两条多边形折线互不相交。此外,可假设任一多边形中不存在三个连续顶点共线。
输出格式
Your output should contain only one line, with the words "YES" or "NO", depending on whether the two given polygons are well-connected.
你的输出应仅包含一行,根据给定的两个多边形是否连通良好,输出单词“YES”或“NO”。
输入输出样例
输入#1
4 0 0 0 2 0 0 2 2 0 0 2 0 4 1 1 -1 1 1 1 1 3 1 1 3 -1
输出#1
YES
说明/提示
On the picture below, the two polygons are well-connected, as the edges of the vertical polygon cross the area of the horizontal one exactly once in one direction (for example, from above to below), and zero times in the other (in this case, from below to above). Note that the polygons do not have to be parallel to any of the xy-,xz-,yz- planes in general. 
如下图所示,这两个多边形是良好连接的,因为竖直多边形的边恰好在某一方向(例如从上到下)穿过水平多边形的内部区域一次,而在另一方向(本例中为从下到上)则不穿过。注意:一般情况下,这些多边形不必与任意一个 xy-、xz- 或 yz- 平面平行。

输入解题思路,AI测评打分。不知道怎么写?