QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 512 MB Total points: 100

#1667. 光纤形状

Statistics

想象一块板子上钉了 $n$ 枚钉子,第 $i$ 枚钉子的位置为 $(x_i, y_i)$。为简化起见,我们将问题限制在钉子位于凸多边形顶点的情况。

然后,取一根长度为 $l$ 的不可伸缩绳子,将其绕过所有钉子。将一支铅笔放入绳圈内,并向各个方向拉紧绳子,画出一条曲线。下图展示了一个绳子绕过钉子并被铅笔(点 $P$)拉紧的例子。

你的任务是求出这条曲线内部的面积。形式化地,对于给定的凸多边形 $S$ 和长度 $l$,定义纤维形状 $F(S, l)$ 为满足以下条件的点 $t$ 的集合:$S \cup \{t\}$ 的凸包周长不超过 $l$。求 $F(S, l)$ 的面积。

输入格式

第一行包含两个整数 $n$ 和 $l$ ($3 \le n \le 10^4$; $1 \le l \le 8 \cdot 10^5$),分别表示多边形 $S$ 的顶点数和绳子的长度。接下来 $n$ 行,每行包含两个整数 $x_i$ 和 $y_i$ ($-10^5 \le x_i, y_i \le 10^5$),表示多边形顶点按逆时针顺序排列的坐标。多边形的所有内角均严格小于 $\pi$。长度 $l$ 超过多边形周长至少 $10^{-3}$。

输出格式

输出一个浮点数,表示纤维形状 $F(S, l)$ 的面积。如果你的答案的绝对误差或相对误差不超过 $10^{-6}$,则视为正确。

样例

输入 1

3 4
0 0
1 0
0 1

输出 1

3.012712585980357

输入 2

4 5
0 0
1 0
1 1
0 1

输出 2

5.682061989789656

输入 3

5 17
0 0
2 -1
3 0
4 3
-1 4

输出 3

37.719371276930820

说明

下图展示了样例测试。

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.