Smuggler's Rift
You are a bounty hunter searching for the hidden treasure of the legendary pharaoh, King Patrick III.
During his lifetime, Patrick considered many possible locations to bury his treasure. Each year, he recorded one such location as a simple polygon in the Western Desert.
After his death, his subjects buried the treasure at a location that lies inside the maximum number of these polygons. Now you want to find the area enclosing all points where Patrick's treasure could be.
Input
The first line contains a single integer
— the number of locations Patrick considered for burying his treasure.
Then follow blocks, each describing a polygon:
The first line of each block contains an integer
, the number of vertices of the polygon.
Then
lines follow, each containing two integers
and
, the coordinates of the
-th vertex of the polygon. The vertices are given in clockwise or counterclockwise order.
It is guaranteed that the sum of over all polygons does not exceed 50.
Output
Output the area corresponding to the overlap between the maximum number of overlapping locations, in units squared. Your answer will be considered correct if it has an absolute error of no more than .
Note
Please use Pypy3 for your Python submissions.
Example
Input 1
3
3
1 10
18 19
15 6
4
2 3
1 19
17 18
17 10
3
5 2
10 16
17 4
Output 1
30.584960
The maximum number of overlapping polygons is . This occurs in an area of about
units squared, as shown below.
Any answer between
and
units squared will be accepted.

Input 2
3
5
0 0
20 0
20 20
10 10
3
0 2
10 2
5 20
3
10 5
20 5
15 20
Output 2
65.601740
The polygons given aren't nessecarily convex, and there can be more than one region with the maxiomum number of overlapping polygons.

Input 3
2
4
0 0
0 1
1 1
1 0
4
0 1
0 2
1 2
1 1
Output 3
2.000000
Polygons that touch on the edges don't count as overlapping.

Comments