CF62C.Inquisition

提高+/省选-

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 105. 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 (105;105). 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.

中世纪时期曾流行一种传统:将女巫与其宠物——黑猫一同绑在火刑柱上烧死。到15世纪末,黑猫种群已彻底灭绝。这一严峻形势促使成立了紧急宗教裁判委员会(EIC)。

第666号决议规定:一只白猫当且仅当其黑色斑点的周长超过“可接受阈值”时,才被视为黑猫。但该“可接受阈值”究竟等于多少?每位宗教裁判官将根据具体情况自行确定。而你的任务是:计算猫毛上所有黑色斑点的总周长。

同一决议还规定:猫毛为一块边长为 10510^5 的白色正方形区域。在测量斑点时,习惯上将毛皮左下角置于坐标系原点 (0,0)(0,0),右上角置于坐标 (105,105)(10^5,10^5)。猫身上的斑点均为非退化三角形。这些斑点之间可以相交、重叠,但保证任意两个三角形斑点的任意两条边至多只有一个公共点。

本题中,“周长”定义为猫毛上发生颜色变化的所有边界线段的总长度。

输入格式

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 < 105).

第一行输入包含一个整数 nn(0 ≤ n ≤ 1000 ≤ n ≤ 100),表示猫毛上斑点的数量。接下来的 nn 行中,第 ii 行包含 6 个整数:x1ix_{1i}、y1iy_{1i}、x2ix_{2i}、y2iy_{2i}、x3ix_{3i}、y3iy_{3i}。它们是第 ii 个三角形斑点的顶点坐标(0 < xji, yji < 1050 < x_{ji}, y_{ji} < 10^5)。

输出格式

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.

输出一个数字,即三角形并集的周长。你的答案与正确答案的误差不应超过 10−610^{-6}。

输入输出样例

  • 输入#1

    1
    1 1 2 1 1 2

    输出#1

    3.4142135624
  • 输入#2

    3
    3 3 10 3 3 10
    1 1 9 4 5 6
    2 2 11 7 6 11

    输出#2

    37.7044021497

输入解题思路,AI测评打分。不知道怎么写?

首页