QOJ.ac

QOJ

Time Limit: 5.0 s Memory Limit: 64 MB Total points: 100

#18082. 双缝实验

Statistics

Friedrich von Krüger 教授想要进行一项经典双缝实验的改进版本。众所周知,该实验中光线穿过带有两条平行窄缝的不透明板,从而展示某种量子现象。

该实验的改进之处在于让光线穿过两块板而不是一块;教授相信这一改进将有助于发现前所未有的新量子现象。

教授已经制作了必要的板。它们是大小相同的圆盘,厚度极薄,可以忽略不计。这些板可以重叠在一起,并绕着共同的中心旋转。第一块板有两条窄缝,可以看作是距离圆盘中心 $r$ 的两条平行直线。第二块板有一个凸多边形形状的孔。圆盘的中心位于多边形内部,且多边形边界上的每一点到圆盘中心的距离都严格大于 $r$。

教授的计算表明,穿过板的光线越少,成功的概率就越高。因此,教授希望旋转这些板,使得狭缝与多边形的交集总长度最小。

请确定交集总长度的最小值。

输入格式

第一行包含两个整数 $n$ 和 $r$ —— 多边形的顶点数以及狭缝到圆盘中心的距离 ($3 \le n \le 10^4, 1 \le r \le 10^5$)。

接下来的 $n$ 行描述多边形的顶点。第 $i$ 行包含 $x_i$ 和 $y_i$,描述了相对于放置在原点 $(0, 0)$ 的圆盘中心的第 $i$ 个顶点的坐标 ($-10^6 \le x_i, y_i \le 10^6$)。顶点按顺时针或逆时针顺序排列。

保证多边形边界上的任何点到圆盘中心的距离都严格大于 $r$。

输出格式

输出一个数字 —— 交集总长度的最小值,精度要求为 $10^{-6}$。

样例

样例输入 1

4 1
5 5
-5 5
-5 -5
5 -5

样例输出 1

20.00000000000000000000

样例输入 2

4 3
5 5
-5 5
-5 -5
5 -5

样例输出 2

16.28427124746190202131

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.