QOJ.ac

QOJ

حد الوقت: 6.0 s حد الذاكرة: 512 MB مجموع النقاط: 100 قابلة للهجوم ✓

#6813. 扇形并

الإحصائيات

给定 $n$ 个非退化的扇形,满足以下保证:

  • 中心角小于或等于 180 度。
  • 不存在两个半径和圆心完全相同的扇形。
  • 如果两个扇形存在共线的半径,它们不会共享任何点。

请计算这些扇形并集的面积。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 1000$),表示扇形的数量。

接下来 $n$ 行,第 $i$ 行包含六个整数 $x_{i,o}, y_{i,o}, x_{i,a}, y_{i,a}, x_{i,b}, y_{i,b}$ ($-10^4 \le x_{i,o}, y_{i,o}, x_{i,a}, y_{i,a}, x_{i,b}, y_{i,b} \le 10^4$),分别表示第 $i$ 个扇形的圆心 $O_i(x_{i,o}, y_{i,o})$ 以及两个端点 $A_i(x_{i,a}, y_{i,a})$ 和 $B_i(x_{i,b}, y_{i,b})$ 的坐标。第 $i$ 个扇形定义为线段 $O_iA_i$ 绕点 $O_i$ 逆时针旋转至 $O_iB_i$ 所经过的区域。保证:

  • $O_i, A_i$ 和 $B_i$ 不会重合。
  • $|O_iA_i| = |O_iB_i|$。
  • $\vec{O_iA_i} \times \vec{O_iB_i} \ge 0$,其中 $\times$ 表示二维向量的叉积模,定义为 $a \times b = a.x \cdot b.y - a.y \cdot b.x$。等号成立当且仅当两个向量方向相反。

输出格式

输出这些扇形并集的面积,保留为单行上的一个十进制数。如果你的答案与标准答案的绝对误差或相对误差不超过 $10^{-6}$,则视为正确。

样例

输入 1

3
0 0 5 0 -5 0
-1 -1 4 3 -6 3
1 -2 2 -2 1 -1

输出 1

47.9378026054

输入 2

1
0 0 -10000 -10000 10000 10000

输出 2

314159265.3589793238

说明

第一个测试用例可以用下图表示:

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.