A Math Contest P12 - Triangles

View as PDF

Submit solution

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

Problem types

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


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

0 0 1 1 0 1
0 0 1 0 1 1

Sample Output



There are no comments at the moment.