|
||||||||||
CRB and FarmTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 541 Accepted Submission(s): 84 Special Judge Problem Description CRB has a farm. His farm has a shape of convex polygon. There are $K$ barns in the farm. All of them are strictly inside the polygon. CRB wants to build a fence enclosing all the barns. He prepared $2K$ posts and steel strips of exactly the same length with the perimeter of his farm. A post can only be placed on the vertex of the polygon(farm), and steel strips must enclose all posts. Now, CRB wonders whether he can build a fence with currently available resources or not. Can you help him? Input There are multiple test cases. The first line of input contains an integer $T$, indicating the number of test cases. For each test case: The first line contains an integer $N$ ¨C the number of vertices of the convex polygon(the shape of CRB¡®s farm). Then $N$ lines follow, $i$-th line containing two integers $x$ and $y$, the coordinates of $i$-th vertex. The vertices are given in counter-clockwise order. The first line contains an integer $K$ ¨C the number of barns. Each of the next $K$ lines contains two integers $x$ and $y$, the coordinates of the barn. 1 ¡Ü $T$ ¡Ü 9 3 ¡Ü $N$, $K$ ¡Ü 2 * $10^{5}$ $-10^{9}$ ¡Ü $x$, $y$ ¡Ü $10^{9}$ All points(including farm vertices and barns) are pairwise different. It is guaranteed that the barns never all lie on a line. Output For each test case, output ¡°Yes¡± if it is possible to build a fence, otherwise output ¡°No¡±. If possible, output a solution in the following format: On the first line, output an integer $M$ - the number of posts used to build a fence. On the next line, you should output the indices of the vertices(1-based) where you place posts in increasing order. Your solution will be accepted if $M$ ¡Ü $2K$ and the length of the fence is not longer than the perimeter of the farm. Also, the barns must be strictly inside the fence. Sample Input
Sample Output
Author KUT£¨DPRK£© Source | ||||||||||
|