## LCC '22 Contest 3 S5 - Umbrella

View as PDF

Points: 15
Time limit: 3.0s
Memory limit: 128M

Author:
Problem types

Along the palm beaches of Hawaii in the blazing summer are numerous umbrellas. When facing the ocean, the umbrellas appear to be isosceles triangles with one side on the x axis and the other sides will have equal length. Let's take a picture - but before we do that, can you estimate the area of all the umbrellas together?

For this problem, there are umbrellas each with one vertex at and another vertex at . For each umbrella, its third vertex is at . You are tasked with finding the area of the union of all the umbrellas (total area, where a region overlapped by multiple umbrellas should only be counted once in total).

#### Input Specification

The first line contains , the number of umbrellas.

The next lines each contain 3 integers: , , and , describing the -th umbrella.

#### Output Specification

One decimal number, the area of the union of all umbrellas. Your answer will be regarded as correct if it has an absolute or relative error at most

#### Sample Input

2
1 5 2
3 11 2

#### Sample Output

11.3333

#### Sample Explanation

There is a triangle with vertices , and . There is another with vertices , , and . A diagram for the triangles is shown below

We wish to find this area:

Its area is . If you wish to find the area yourself, note that the two triangles intersect at .