ウルシステムズプログラミングコンテスト2023(AtCoder Beginner Contest 286)
翻译中…
Problem Statement
翻译中…
On a two-dimensional plane, there is a convex polygon $C$ with $N$ vertices, and points $S=(s_x, s_y)$ and $T=(t_x,t_y)$. The vertices of $C$ are $(x_1,y_1),(x_2,y_2),\ldots$, and $(x_N,y_N)$ in counterclockwise order. It is guaranteed that $S$ and $T$ are outside the polygon.
翻译中…
Find the shortest distance that needs to be traveled to get from point $S$ to point $T$ without entering the interior of $C$ except for its circumference.
翻译中…
Constraints
翻译中…
$3\leq N \leq 10^5$$|x_i|,|y_i|,|s_x|,|s_y|,|t_x|,|t_y|\leq 10^9$$(x_1,y_1),(x_2,y_2),\ldots$, and$(x_N,y_N)$form a convex polygon in counterclockwise order.- No three points of
$C$are colinear. $S$and$T$are outside$C$and not on the circumference of$C$.- All values in the input are integers.
翻译中…
Input
翻译中…
The input is given from Standard Input in the following format:
翻译中…
N
x_1 y_1
x_2 y_2
\vdots
x_N y_N
s_x s_y
t_x t_y
翻译中…
Output
翻译中…
Print the answer.
翻译中…
Your output is considered correct if the absolute or relative error from the true value is at most $10^{-6}$.
翻译中…
样例
Input #1
4
1 1
3 1
3 3
1 3
0 2
5 2
Output #1
5.65028153987288474496
One way to achieve the shortest distance is shown in the following figure.

If you travel as $(0,2) \to (1,3) \to(3,3)\to(5,2)$, the length of the path from point $S$ to point $T$ is $5.650281...$. We can prove that it is the minimum. Note that you may enter the circumference of $C$.
Note that your output is considered correct if the absolute or relative error is at most $10^{-6}$. For example, output like `5.650287` is also considered correct.
Input #2
3
0 0
2 0
1 10
3 7
10 3
Output #2
8.06225774829854965279
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。