F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

CRB and Farm

Time 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
1 5 0 1 3 0 4 2 2 3 0 3 3 2 1 3 1 3 2
 

Sample Output
Yes 4 1 2 3 4
 

Author
KUT£¨DPRK£©
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-02 19:22:19, Gzip enabled