atcoder#ABC286H. [ABC286Ex] Don’t Swim
[ABC286Ex] Don’t Swim
Score : points
Problem Statement
On a two-dimensional plane, there is a convex polygon with vertices, and points and . The vertices of are , and in counterclockwise order. It is guaranteed that and are outside the polygon.
Find the shortest distance that needs to be traveled to get from point to point without entering the interior of except for its circumference.
Constraints
- , and form a convex polygon in counterclockwise order.
- No three points of are colinear.
- and are outside and not on the circumference of .
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Your output is considered correct if the absolute or relative error from the true value is at most .
4
1 1
3 1
3 3
1 3
0 2
5 2
5.65028153987288474496
One way to achieve the shortest distance is shown in the following figure.
If you travel as , the length of the path from point to point is . We can prove that it is the minimum. Note that you may enter the circumference of .
Note that your output is considered correct if the absolute or relative error is at most . For example, output like 5.650287
is also considered correct.
3
0 0
2 0
1 10
3 7
10 3
8.06225774829854965279