P2510 [HAOI2008] Falling Disks

Description

There are n disks falling from the sky, and those that fall later can cover those that fell earlier. Find the perimeter of the final closed region formed. See the figure below; the total length of all the red curves is the required answer. ![](https://cdn.luogu.com.cn/upload/pic/1628.png)

Input Format

The first line contains an integer n. Each of the next n lines contains three real numbers r_i, x_i, y_i, representing the radius and the center coordinates of the i-th disk.

Output Format

Output the final perimeter, to three decimal places.

Explanation/Hint

Constraints 1 ≤ n ≤ 1000. Translated by ChatGPT 5