Hide

Problem A
Arcane Territory

Taylor is playing a new strategy board game called Arcane Territory. The game takes place on a flat 100 $\times $ 100 battlefield where players compete to control magical regions.

Each turn, players place magic beacons on the board. A beacon generates a circular aura of influence, claiming all points within its range. However, a point on the battlefield can only be controlled once, even if multiple auras overlap.

At the end of the round, you must determine the total area of the battlefield that is controlled by at least one beacon.

\includegraphics[width=0.4\linewidth ]{sample.png}
Figure 1: Visualization of the battlefield configuration for the sample input

Input

The input describes a single battlefield configuration.

The first line contains an integer $N$ ($1 \le N \le 50$), the number of beacons that are on the battlefield.

The next $N$ lines each contain:

  • a real number $r$ ($1 \le r \le 50$), the radius of the beacon.

  • a real number $x$ ($r \le x \le 100 - r$), the x-coordinate of the beacon.

  • a real number $y$ ($r \le y \le 100 - r$), the y-coordinate of the beacon.

Each number contains at most 5 digits after the decimal point. It is guaranteed that the area covered by all beacons lies entirely within the 100 $\times $ 100 battlefield.

Output

Print a single line containing the total area covered by all the beacons with a relative error of at most $10^{-5}$.

Sample Input 1 Sample Output 1
4
3.0 6.0 5.0
3.0 13.0 7.0
6.0 13.0 7.0
2.0 4.0 10.0
148.20428322176423

Please log in to submit a solution to this problem

Log in