QOJ.ac

QOJ

时间限制: 1 s 内存限制: 512 MB 总分: 100

#1852. 涂色

统计

Zbox 在垃圾堆里发现了一块古老的电子画板。他发现这块画板竟然还能奇迹般地工作!由于画板比较老旧,Zbox 只能在上面使用黑色和白色进行绘画。

现在,Zbox 试图操作这块画板来绘制一些酷炫的图案。

这块画板初始时完全是白色的,并支持对选定圆形的“颜色反转”操作。在第 $i$ 次操作中,Zbox 指定一个圆心坐标为 $(x_i, y_i)$、半径为 $r_i$ 的圆,并使用“颜色反转”工具。操作后,该圆内的黑色部分变为白色,白色部分变为黑色。

由于某些原因,Zbox 关心每一时刻画板上黑色部分的总面积。Zbox 人很好!为了避免考虑一些极端情况,他的操作保证了一些性质。详情请参阅下方的数据范围。

输入格式

第一行包含一个整数 $q$,表示操作的总数 ($1 \le q \le 1000$)。

接下来的 $q$ 行,每行包含三个实数 $x, y$ 和 $r$,其中 $(x, y)$ 是第 $i$ 次“颜色反转”操作所选圆的圆心,而 $r$ 是其半径。

所有数据点保证满足以下数据范围:

  1. 对于任意两个用于“颜色反转”的圆,它们的圆心不重合。具体而言,圆心之间的距离大于 $10^{-4}$。
  2. 对于任意两个用于“颜色反转”的圆,它们的圆周不相切。具体而言,圆心之间的距离与半径之和的差的绝对值大于 $10^{-4}$,且圆心之间的距离与半径之差的绝对值的差的绝对值大于 $10^{-4}$。
  3. 输入数据中每个实数的绝对值最大为 $10^4$。

输出格式

在每次操作后,输出画板上黑色部分的总面积。如果输出与标准答案的绝对误差或相对误差不超过 $10^{-6}$,则认为答案正确。

样例

样例输入 1

5
0 0 11
26 0 11
52 0 11
13 -11 11
39 -11 11

样例输出 1

380.132711
760.265422
1140.398133
1331.290110
1522.182087

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.