CF814D.An overnight dance in discotheque

普及/提高-

通过率:0%

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 xyxy -plane, in which there are a total of nn dancers. Once someone starts moving around, they will move only inside their own movement range, which is a circular area CiC_{i} described by a center (xi,yi)(x_{i},y_{i}) and a radius rir_{i} . No two ranges' borders have more than one common point, that is for every pair (i,j)(i,j) ( 1<=i<j<=n ) either ranges CiC_{i} and CjC_{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.

输入格式

The first line of input contains a positive integer nn ( 1<=n<=10001<=n<=1000 ) — the number of dancers.

The following nn lines each describes a dancer: the ii -th line among them contains three space-separated integers xix_{i} , yiy_{i} and rir_{i} ( 106<=xi,yi<=106-10^{6}<=x_{i},y_{i}<=10^{6} , 1<=ri<=1061<=r_{i}<=10^{6} ), describing a circular movement range centered at (xi,yi)(x_{i},y_{i}) with radius rir_{i} .

输出格式

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 10910^{-9} . Formally, let your answer be aa , and the jury's answer be bb . Your answer is considered correct if .

输入输出样例

  • 输入#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.

首页