QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100

#3524. 长曝光摄影

Statistiques

Gwen 在一张大方格纸上画了一些表面完全为黑色的矩形。为了确保一切看起来整洁美观,她所有矩形的边都位于纸张的网格线上。现在,她打算在快速旋转纸张的同时拍摄一张照片。相机的曝光时间足够覆盖平面的完整旋转。在最终的照片中,在整个旋转过程中始终被矩形覆盖的区域将呈现黑色,而从未被矩形覆盖的区域将呈现白色。剩余的“模糊”区域亮度可能会有所不同,但 Gwen 将它们统一视为灰色。

现在,在拍照之前,Gwen 告诉了你她所画矩形的坐标,并要求你确定照片表面积中有多少是黑色的,有多少是灰色的。

图 L.1:第一个样例输入及生成的照片。

输入格式

输入包含: 一行包含一个整数 $n$ ($1 \le n \le 1\,000$),表示矩形的数量。 $n$ 行,每行包含四个数字:两个整数 $x_{min}, y_{min}$ ($-10^9 \le x_{min}, y_{min} \le 10^9$),表示矩形左下角的坐标(即 $x$ 和 $y$ 值最小的角),以及两个整数 $w, h$ ($1 \le w, h \le 200$),表示矩形的宽和高。

平面绕原点 $(0, 0)$ 旋转,你可以放心地假设整张纸在整个旋转过程中都被相机完全捕捉到。

输出格式

输出两个实数,第一个是黑色区域的面积,第二个是照片表面灰色部分的面积。如果一个数字的绝对误差或相对误差不超过 $10^{-6}$,则被认为是正确的。

样例

样例输入 1

4
-2 1 4 1
-2 -2 1 4
-2 -2 4 1
1 -2 1 4

样例输出 1

6.2831853
15.7079633

样例输入 2

1
0 0 2 2

样例输出 2

0.0
25.1327412

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.