Polygon Partition
시간 제한3초메모리 제한2048 MB
단순 다각형의 꼭짓점이 주어질 때 경계 위의 반정수점을 모두 찾고, 그 바닥값들을 합이 같은 두 부분집합으로 나눌 수 있는지 판정한다.
문제
A simple polygon is a polygon that is not self-intersecting and does not contain any holes. You are given the vertices of a simple polygon, , , \ldots, , where , and and are the -coordinate and -coordinate of the vertex, respectively. The vertices are distinct and given in counterclockwise order (so there is an edge between each pair of consecutive vertices; there is also an edge from back to ).
The polygon's boundary does not pass through any lattice points (a lattice point is a point where both coordinates are integers). In addition, none of the or values are exactly an integer.
A semi-integer point is a point where exactly one of its coordinates is an integer. Let \mathcal{P} = \left\\{p\_1, p\_2, \ldots, p\_k\right\\} be all of the semi-integer points that lie on the boundary of the polygon. For each semi-integer point in , let be the floor of the non-integer coordinate of . For a subset of , let be the sum of the of the points in (with ). Does there exist a partition of into two subsets and so that the ?
(Two sets and are a partition of if and . There are no other restrictions on and so long as these two conditions hold and . In particular, empty sets are allowed, and the semi-integer points in each set do not have to be contiguous around the polygon boundary.)
입력
The first line of input contains one integer (), the number of vertices of the polygon.
Each of the next lines contains two space-separated real numbers and (): the coordinates of the polygon vertices, in counterclockwise order. Each coordinate will have exactly digits after the decimal point and will not be exactly an integer.
It is guaranteed that the polygon does not self-intersect, that the vertices are distinct, and that the polygon boundary does not pass through any lattice points.
출력
If there is no solution, print and no further output.
Otherwise, print a single integer on its own line: the number of semi-integer points in one of the two subsets in a valid partition of . On the next lines of output, print the values for the points in that subset, one per line.
If there are multiple valid partitions, you may choose any of them. You may print either of its two subsets, and you may list the subset's values in any order.