CF1218B.Guarding warehouses

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Bob Bubblestrong just got a new job as security guard. Bob is now responsible for safety of a collection of warehouses, each containing the most valuable Bubble Cup assets - the high-quality bubbles. His task is to detect thieves inside the warehouses and call the police.

Looking from the sky, each warehouse has a shape of a convex polygon. Walls of no two warehouses intersect, and of course, none of the warehouses is built inside of another warehouse.

Little did the Bubble Cup bosses know how lazy Bob is and that he enjoys watching soap operas (he heard they are full of bubbles) from the coziness of his office. Instead of going from one warehouse to another to check if warehouses are secured, the plan Bob has is to monitor all the warehouses from the comfort of his office using the special X-ray goggles. The goggles have an infinite range, so a thief in any of the warehouses could easily be spotted.

However, the goggles promptly broke and the X-rays are now strong only enough to let Bob see through a single wall. Now, Bob would really appreciate if you could help him find out what is the total area inside of the warehouses monitored by the broken goggles, so that he could know how much area of the warehouses he needs to monitor in person.

输入格式

The first line contains one integer NN ( 11 \leq NN \leq 10410^4 ) – the number of warehouses.

The next NN lines describe the warehouses.

The first number of the line is integer cic_i ( 33 \leq cic_i \leq 10410^4 ) – the number corners in the ithi^{th} warehouse, followed by cic_i pairs of integers. The jthj^{th} pair is (xj,yj)(x_j, y_j) – the coordinates of the jthj^{th} corner ( xj|x_j| , yj|y_j| \leq 31043 * 10^4 ). The corners are listed in the clockwise order. The total number of corners in all the warehouses is at most 51045 * 10^4 .

Bob's office is positioned at the point with coordinates (0,0)(0, 0) . The office is not contained within any of the warehouses.

输出格式

Print a single line containing a single decimal number accurate to at least four decimal places – the total area of the warehouses Bob can monitor using the broken X-ray goggles.

输入输出样例

  • 输入#1

    5
    4 1 1 1 3 3 3 3 1
    4 4 3 6 2 6 0 4 0
    6 -5 3 -4 4 -3 4 -2 3 -3 2 -4 2
    3 0 -1 1 -3 -1 -3
    4 1 -4 1 -6 -1 -6 -1 -4
    

    输出#1

    13.333333333333
    

说明/提示

Areas monitored by the X-ray goggles are colored green and areas not monitored by the goggles are colored red.

The warehouses ABCDABCD , IJKIJK and LMNOPQLMNOPQ are completely monitored using the googles.

The warehouse EFGHEFGH is partially monitored using the goggles: part EFWEFW is not monitored because to monitor each point inside it, the X-rays must go through two walls of warehouse ABCDABCD .

The warehouse RUTSRUTS is not monitored from the Bob's office, because there are two walls of the warehouse IJKIJK between Bob's office and each point in RUTSRUTS .

The total area monitored by the goggles is PP = PABCDP_{ABCD} + PFGHWP_{FGHW} + PIJKP_{IJK} + PLMNOPQP_{LMNOPQ} = 44 + 3.3333333333333.333333333333 + 22 + 44 = 13.33333333333313.333333333333 .

首页