This page is still under construction.

Parts of this page are still being built. What you see may change.

Stacked Colored Paper

Time limit1sMemory limit512 MB

Summary
After gluing up to 200 triangles and circles in order, print each sheet's visible area after every prefix of the stack.
Level

Hard8 of 10

Topics
Geometry, Math
Solved
No attempts yet

Problem

You glue NN sheets of colored paper onto the coordinate plane one sheet at a time, and no two sheets share a color. A sheet always lands on top of the plane and on top of every sheet that is already glued down. You cannot glue a sheet under the plane, and you cannot slide one between two sheets that are already there.

A sheet has one of two shapes.

  1. A triangle with vertices (x1,y1)(x_1, y_1), (x2,y2)(x_2, y_2), (x3,y3)(x_3, y_3)
  2. A circle with center (x,y)(x, y) and radius rr

Number the sheets from 11 to NN and glue them in increasing order of number. The picture below shows one gluing process.

For every ii, report how much of each glued sheet is visible at the moment sheets 11 through ii are all in place.

Input

The first line contains an integer NN (1≤N≤2001 \le N \le 200).

Each of the next NN lines describes one sheet in gluing order. Line ii (1≤i≤N1 \le i \le N) starts with an integer tt (1≤t≤21 \le t \le 2), the shape of sheet ii.

If t=1t = 1, sheet ii is a triangle, and six integers x1x_1, y1y_1, x2x_2, y2y_2, x3x_3, y3y_3 (−100≤x1,y1,x2,y2,x3,y3≤100-100 \le x_1, y_1, x_2, y_2, x_3, y_3 \le 100) follow on the same line, separated by spaces. The three vertices are never collinear.

If t=2t = 2, sheet ii is a circle, and three integers follow on the same line, separated by spaces: the center coordinates xx, yy (−100≤x,y≤100-100 \le x, y \le 100) and the radius rr (1≤r≤1001 \le r \le 100).

Output

Print NN lines. Line ii (1≤i≤N1 \le i \le N) contains ii numbers separated by spaces: once sheets 11 through ii have been glued down in order, the visible area of sheet 11, the visible area of sheet 22, and so on through the visible area of sheet ii.

Round every area to six digits after the decimal point and print exactly six digits. An area of 22 prints as 2.000000, and a sheet that is completely hidden prints as 0.000000.

Examples2

  1. Example 1

    Input
    2
    2 0 0 1
    1 0 0 2 0 0 2
    
    Expected output
    3.141593
    2.356194 2.000000
    
  2. Example 2

    Input
    3
    2 0 0 3
    2 0 0 2
    2 0 0 1
    
    Expected output
    28.274334
    15.707963 12.566371
    15.707963 9.424778 3.141593