#P4534. [CTSC2004] 最优切割
[CTSC2004] 最优切割
Description
The HURRICANE team needs to cut out a part from within a template.
Both the template and the part are given convex polygons, and the position of the part inside the template is fixed.
For the part, for any two non-adjacent edges, the intersection point of the extensions of their supporting lines lies outside the template.
Due to factory constraints, each cut must follow the straight line containing some edge of the part, splitting the template into two pieces. Keep the piece that contains the part and continue cutting.
The cost of each cut is the length of the cut mark on the template. You need to compute the minimum total cost required to cut out the part.
Input Format
The first line contains a positive integer , the number of vertices of the template.
The next lines each contain two real numbers , giving the coordinates of the template’s vertices listed in counterclockwise order.
The -th line contains a positive integer , the number of vertices of the part.
The next lines each contain two real numbers , giving the coordinates of the part’s vertices listed in counterclockwise order.
Output Format
Output a single integer, which is the minimum total cost rounded to the nearest integer.
4
0 0
3 0
3 3
0 3
4
1 1
2 1
2 2
1 2
8
4
0 0
3 0
3 3
0 3
4
0 0
2 0
2 3
0 3
3
Hint
For of the testdata, it is guaranteed that and .
Translated by ChatGPT 5
京公网安备 11011102002149号