luogu#P4196. 【模板】半平面交 / [CQOI2006] 凸多边形

    ID: 3147 problem_type.remote_judge 1000ms 125MiB Tried: 1 맞았습니다.: 1 난이도: 8 아이디: 태그>2006重庆各省省选排序向量队列半平面交

【模板】半平面交 / [CQOI2006] 凸多边形

Problem Description

Given nn convex polygons with vertices listed in counterclockwise order, find the area of their intersection. For example, when n=2n = 2, the two convex polygons are shown below:

The area of the intersection is 5.2335.233.

Input Format

The first line contains an integer nn, the number of convex polygons. Each polygon is then described in order. For the ii-th polygon, the first line contains an integer mim_i, the number of edges. The next mim_i lines each contain two integers, giving the coordinates of the vertices in counterclockwise order.

Output Format

Output a single real number, the area of the intersection, rounded to three decimal places.

2
6
-2 0
-1 -2
1 -2
2 0
1 2
-1 2
4
0 -3
1 -1
2 2
-1 0
5.233

Hint

Constraints: For 100%100\% of the testdata: 2n102 \leq n \leq 10, 3mi503 \leq m_i \leq 50, and each coordinate is an integer in [1000,1000][-1000, 1000].

Translated by ChatGPT 5