Codeforces Beta Round 58
C
Inquisition
Codeforces
2300
原题
← BD →
翻译中…

In Medieval times existed the tradition of burning witches at steaks together with their pets, black cats. By the end of the 15-th century the population of black cats ceased to exist. The difficulty of the situation led to creating the EIC - the Emergency Inquisitory Commission.

翻译中…

The resolution #666 says that a white cat is considered black when and only when the perimeter of its black spots exceeds the acceptable norm. But what does the acceptable norm equal to? Every inquisitor will choose it himself depending on the situation. And your task is to find the perimeter of black spots on the cat's fur.

翻译中…

The very same resolution says that the cat's fur is a white square with the length of $10^{5}$. During the measurement of spots it is customary to put the lower left corner of the fur into the origin of axes $(0;0)$ and the upper right one — to the point with coordinates $(10^{5};10^{5})$. The cats' spots are nondegenerate triangles. The spots can intersect and overlap with each other, but it is guaranteed that each pair of the triangular spots' sides have no more than one common point.

翻译中…

We'll regard the perimeter in this problem as the total length of the boarders where a cat's fur changes color.

翻译中…

Input

翻译中…

The first input line contains a single integer $*n*$ ($0 ≤ *n* ≤ 100$). It is the number of spots on the cat's fur. The $*i*$-th of the last $*n*$ lines contains $6$ integers: $*x*_{1*i*}$, $*y*_{1*i*}$, $*x*_{2*i*}$, $*y*_{2*i*}$, $*x*_{3*i*}$, $*y*_{3*i*}$. They are the coordinates of the $*i*$-th triangular spot $(0 < *x*_{*ji*}, *y*_{*ji*} < 10^{5})$.

翻译中…

Output

翻译中…

Print a single number, the answer to the problem, perimeter of the union of triangles. Your answer should differ from the correct one in no more than $10^{ - 6}$.

翻译中…

样例

Input #1
1
1 1 2 1 1 2
Output #1
3.4142135624
InputCopy OutputCopy
Input #2
3
3 3 10 3 3 10
1 1 9 4 5 6
2 2 11 7 6 11
Output #2
37.7044021497
InputCopy OutputCopy
题目信息
题号
62C
时间限制
3 s
内存限制
256 MB
标签
计算几何
模拟
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。