A Math Contest P12 - Triangles

View as PDF

Submit solution

Points: 17
Time limit: 2.0s
Memory limit: 256M

Author:
Problem types

Given N triangles, find the area of the union of these triangles.

Constraints

1 \leq N \leq 100

0 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 10^4

Input Specification

The first line contains an integer, N.

Each of the next N lines contains six space-separated integers, x_1, y_1, x_2, y_2, x_3, y_3, representing the three vertices of the triangle.

Output Specification

Output the union area of the triangles.

Your answer will be accepted if the absolute error is within 10^{-3}.

Sample Input

2
0 0 1 1 0 1
0 0 1 0 1 1

Sample Output

1.000

Comments

There are no comments at the moment.