QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#5060. 圆

Statistics

Pang 教授正在研究最小覆盖圆问题。他不喜欢随机算法,因此决定寻找一种高效的确定性算法。他从二分查找的经典思想入手。在二分查找的每一次迭代中,都需要解决以下问题:

给定圆的半径 $r$ 和一个凸包 $C$,定义 $S$ 为: $$S = \{p \mid \text{以 } p \text{ 为圆心、} r \text{ 为半径的圆覆盖了 } C\}$$ 求 $S$ 的面积。

输入格式

第一行包含一个正整数 $T$,表示测试用例的数量。

对于每个测试用例,第一行包含两个整数 $n$ 和 $r$ ($1 \le n \le 1000, 1 \le r \le 30000$),用空格分隔,分别表示凸包的顶点数和半径。如果 $n = 1$,凸包仅包含一个点。如果 $n = 2$,凸包是一条线段。

接下来的 $n$ 行,每行包含两个整数 $x, y$ ($-10000 \le x, y \le 10000$),用空格分隔,表示一个顶点 $(x, y)$。保证没有两个顶点重合,且没有三个顶点共线。顶点按逆时针顺序给出。

保证所有测试用例的 $n$ 之和不超过 $200000$。

输出格式

输出一个十进制数表示答案。如果你的答案与标准答案的绝对误差或相对误差不超过 $10^{-6}$,则被视为正确。

样例

样例输入 1

3
4 1
0 0
1 0
1 1
0 1
4 1
0 0
1 1
0 2
-1 1
4 100
0 0
1 0
1 1
0 1

样例输出 1

0.315146743628
0
31016.928202570849

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.