CF814D.An overnight dance in discotheque
普及+/提高
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The crowdedness of the discotheque would never stop our friends from having fun, but a bit more spaciousness won't hurt, will it?
The discotheque can be seen as an infinite xy-plane, in which there are a total of n dancers. Once someone starts moving around, they will move only inside their own movement range, which is a circular area C__i described by a center (x__i, y__i) and a radius r__i. No two ranges' borders have more than one common point, that is for every pair (i, j) (1 ≤ i < j ≤ n) either ranges C__i and C__j are disjoint, or one of them is a subset of the other. Note that it's possible that two ranges' borders share a single common point, but no two dancers have exactly the same ranges.
Tsukihi, being one of them, defines the spaciousness to be the area covered by an odd number of movement ranges of dancers who are moving. An example is shown below, with shaded regions representing the spaciousness if everyone moves at the same time.

But no one keeps moving for the whole night after all, so the whole night's time is divided into two halves — before midnight and after midnight. Every dancer moves around in one half, while sitting down with friends in the other. The spaciousness of two halves are calculated separately and their sum should, of course, be as large as possible. The following figure shows an optimal solution to the example above.

By different plans of who dances in the first half and who does in the other, different sums of spaciousness over two halves are achieved. You are to find the largest achievable value of this sum.
迪斯科舞厅的拥挤程度从来都不会妨碍我们的朋友们尽情欢乐,但若能再宽敞一些,岂不更好?
迪斯科舞厅可被建模为一个无限延伸的 xy-平面,其中有 n 位舞者。一旦某人开始起舞,其活动范围便严格限制在自身专属的运动区域内;该区域是一个以 (xi,yi) 为圆心、半径为 ri 的圆形区域 Ci。任意两个区域边界的交点至多只有一个,即:对任意一对索引 (i,j)(其中 1≤i<j≤n),区域 Ci 与 Cj 要么互不相交,要么其中一个完全包含于另一个之中。注意,两个区域的边界可能恰好相切(即共享唯一一个公共点),但不存在两位舞者拥有完全相同的运动区域。
作为其中一员的月姬(Tsukihi)将“宽敞度”(spaciousness)定义为:正在运动的舞者之运动区域中,被奇数个区域所覆盖的总面积。下图即为一个示例:若所有舞者同时起舞,则阴影部分即代表此时的宽敞度。

然而,毕竟没人会整晚不停跳舞——因此整晚被划分为两个时段:午夜前与午夜后。每位舞者仅在其中一个时段跳舞,而在另一时段则静坐与朋友交谈。两个时段各自的宽敞度分别计算,其总和自然应尽可能大。下图展示了上述示例的一个最优分配方案:

通过为不同时段安排不同的舞者组合,可获得不同的两时段宽敞度之和。你的任务是求出该和的最大可能值。
输入格式
The first line of input contains a positive integer n (1 ≤ n ≤ 1 000) — the number of dancers.
The following n lines each describes a dancer: the i-th line among them contains three space-separated integers x__i, y__i and r__i ( - 106 ≤ x__i, y__i ≤ 106, 1 ≤ r__i ≤ 106), describing a circular movement range centered at (x__i, y__i) with radius r__i.
输入的第一行包含一个正整数 n(1≤n≤1000)—— 舞者的数量。
接下来的 n 行每行描述一位舞者:其中第 i 行包含三个以空格分隔的整数 xi、yi 和 ri(−106≤xi,yi≤106,1≤ri≤106),表示该舞者的圆形活动范围,其圆心为 (xi,yi),半径为 ri。
输出格式
Output one decimal number — the largest achievable sum of spaciousness over two halves of the night.
The output is considered correct if it has a relative or absolute error of at most 10 - 9. Formally, let your answer be a, and the jury's answer be b. Your answer is considered correct if
.
输出一个十进制数——两个夜晚半段所能达到的最大宽敞度之和。
若输出结果的相对误差或绝对误差不超过 10−9,则视为正确。形式化地,设你的答案为 a,评测组的答案为 b。当满足
时,你的答案被视为正确。
输入输出样例
输入#1
5 2 1 6 0 4 1 2 -1 3 1 -2 1 4 -1 1
输出#1
138.23007676
输入#2
8 0 0 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8
输出#2
289.02652413
说明/提示
The first sample corresponds to the illustrations in the legend.
第一个样例对应图例中的示意图。
输入解题思路,AI测评打分。不知道怎么写?