#P10703. Union Area of Rotated Square Window Patterns

    ID: 12734 Type: Default 1000ms 256MiB

Union Area of Rotated Square Window Patterns

Union Area of Rotated Square Window Patterns

A 100 cm × 100 cm window has n square window patterns. Each pattern is a square with a diagonal of \(2\) cm, so that its diagonals (of length 2) are parallel to the coordinate axes. In other words, each square has a side length of \(\sqrt{2}\) and an area of 2 cm². A square with its center at \((x_i,y_i)\) covers all points \((x,y)\) that satisfy \(|x-x_i|+|y-y_i|\le 1\) (thus forming a diamond‐shaped region).

Given that the center of the \(i\)th window pattern is pasted on an interior integer coordinate \((x_i,y_i)\) with \(1\le x_i,y_i\le 99\) (so that no center is on the boundary), compute the total area of the window that is covered by at least one window pattern. Note that if pattern regions overlap, the overlapping area should be counted only once. The window is defined with its lower left corner at \((0,0)\) and upper right corner at \((100,100)\), and any parts of a window pattern outside the window are not counted.

inputFormat

The first line contains an integer \(n\) (the number of window patterns). Each of the following \(n\) lines contains two integers \(x_i\) and \(y_i\), indicating the center of the \(i\)th pattern. It is guaranteed that \(1\le x_i,y_i\le 99\).

outputFormat

Output the total area (in square centimeters) of the window that is covered by at least one window pattern. The answer should be printed as a floating‐point number. (It is guaranteed that an answer with an absolute or relative error of 10−6 is accepted.)

sample

1
50 50
2.000000

</p>