| 2025 USP Try-outs |
|---|
| Finished |
In the turbulent times of the Warring States, the renowned warrior Na Tan and his companions traveled to participate in a martial arts tournament. They are all staying in the same room, and before the competition, Na Tan decides to go to the baths to clear his mind. However, upon finishing, he realizes that he made a mistake: he forgot to grab the towel!
Fortunately, the room is empty at the moment, but his companions may return at any moment. Na Tan, determined not to be seen in an embarrassing situation, needs to leave the bath, grab the towel, and return as quickly as possible, without being caught.
The room can be represented by a simple polygon (that is, a polygon whose sides do not cross), and Na Tan's path must occur entirely within this polygon. The door of the bath is located at one of the vertices of the polygon, while the towel is at some point inside the polygon, but not necessarily at a vertex. Na Tan moves at a constant speed of 1 unit per second.
Given this, what is the minimum time required for Na Tan to fetch the towel and return to the bath?
The first line consists of an integer $$$n$$$ ($$$3 \leq n \leq 500$$$) indicating the number of points in the polygon.
The next $$$n$$$ lines contain two integers $$$x$$$ and $$$y$$$ ($$$-10^6 \leq x, y \leq 10^6$$$) that represent the vertices of the polygon. It is guaranteed that the polygon is simple, the vertices are given in counterclockwise order, and that the door of the bath is located at the first vertex of the polygon.
The last line contains two integers $$$x$$$ and $$$y$$$ ($$$-10^6 \leq x, y \leq 10^6$$$) that represent the point of the towel.
It is guaranteed that any three points, including the towel, are not collinear.
Print the minimum time in seconds for Na Tan to go and return starting from the first point and going to the towel. The answer will be considered correct if the absolute or relative difference is less than $$$10^{-4}$$$.
40 010 010 100 108 9
24.083189158
60 200 040 040 5020 4020 2030 32
71.240998704
80 800 050 050 6030 6030 2020 2020 8040 33
179.293545340
| Name |
|---|


