Problem D
Forest Evolution

Ewan is a park ranger, and part of his duty is to observe how the ecosystem changes over time. He has just detected that a group of pine trees and aspens have started to share the same space. Before, there was a clear line between the species.
This isn’t unusual, but Ewan is a bit curious about how this will evolve in the future. To track it, he wants to know how much of the area is covered by both species right now.
Input
The input begins with a single line with two integers
Each tree is represented by two real numbers
Output
Output the area covered by both species in square
metres. Your answer must have an absolute or relative error of
at most
A point is covered by a species if it is at the edge of or inside a triangle made by three distinct trees of that species.
Limits
-
-
-
for all -
Real numbers in the input will have at most
digits after the decimal point
Sample Input 1 | Sample Output 1 |
---|---|
3 3 0.0 6.0 6.0 0.0 6.0 6.0 4.0 4.0 10.0 4.0 4.0 10.0 |
4.0 |
Sample Input 2 | Sample Output 2 |
---|---|
6 4 0.67 10.82 5.58 5.43 5.83 10.79 5.70 15.06 10.53 10.05 10.45 5.22 6.76 8.64 8.93 8.45 6.43 5.34 12.34 2.87 |
10.47478482125473 |