QOJ.ac

QOJ

时间限制: 5.0 s 内存限制: 64 MB 总分: 100

#18082. 二重スリット実験

统计

Friedrich von Krüger 教授は、2つのスリットを用いた古典的な実験の改良版を行おうとしている。ご存知の通り、これは光が2本の平行な狭いスリットを持つ不透明な板を通過し、ある種の量子現象を示す実験である。

この実験の改良点は、光を1枚ではなく2枚の板に通すことである。教授は、この改良によってこれまで知られていなかった新しい量子現象が発見できると考えている。

教授はすでに必要な板を作成している。それらは同じサイズの円盤であり、厚さは無視できるほど薄い。板同士を重ね合わせ、共通の中心の周りで回転させることができる。

1枚目の板には、円盤の中心から距離 $r$ にある平行な直線とみなせる2本の狭いスリットがある。2枚目の板には、凸多角形の形をした穴が開いている。円盤の中心は多角形の内部にあり、多角形の境界上のすべての点は、円盤の中心から距離 $r$ よりも厳密に遠い位置にある。

教授の計算によると、板を通過する光の量が少ないほど、成功の確率が高くなる。そのため、教授はスリットと多角形の交差部分の合計の長さが最小になるように板を回転させたいと考えている。

交差部分の合計の長さの最小値を求めよ。

入力

1行目には、2つの整数 $n$ と $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つの数値として出力せよ。

入出力例

入力 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.