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 \le N \le 100

0 \le x_1, y_1, x_2, y_2, x_3, y_3 \le 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.