#P4196. Intersection Area of Convex Polygons
Intersection Area of Convex Polygons
Intersection Area of Convex Polygons
Given n convex polygons whose vertices are given in counterclockwise order, compute the area of their intersection. More formally, let \(P_1, P_2, \dots, P_n\) be convex polygons. You are to compute the area of \(\bigcap_{i=1}^{n} P_i\).
For example, when \(n=2\), if the two convex polygons are as shown in the figure below, the area of their intersection is approximately \(5.233\).
inputFormat
The first line contains an integer \(n\) denoting the number of convex polygons.
Then for each polygon, the input begins with an integer \(m\) (the number of vertices), followed by \(m\) lines each containing two real numbers \(x\) and \(y\), the coordinates of the polygon vertices in counterclockwise order.
All coordinates are given with at most 6 decimal places.
outputFormat
Output a single line containing a real number which is the area of the intersection of all provided polygons. The answer will be accepted if the absolute or relative error does not exceed \(10^{-3}\).
sample
2
4
0 0
4 0
4 4
0 4
4
2 2
6 2
6 6
2 6
4.000