[POI2009] WSP-Island

题意翻译

### 题目大意 Byteotia岛屿是一个凸多边形,城市全都在海岸上,按顺时针编号 $1$ 到 $n$ 。 任意两个城市之间都有一条笔直的道路相连。道路相交处可以自由穿行。 有一些道路被游击队控制了,不能走,但是可以经过这条道路与未被控制的道路的交点。 问从城市 $1$ 到 $n$ 的最短距离。 ### 输入格式 第一行两个正整数 $n$ 和 $m$ 表示城市数和被控制的道路数。 接下来 $n$ 行,每行两个整数 $x,y$ 表示每个城市的坐标。 接下来 $m$ 行,每行两个整数 $u,v$ 。表示城市 $u$ 和 $v$ 之间的道路不能走,数据保证有解。 ### 输入格式 输出一个实数,表示从 $1$ 到 $n$ 最短道路距离,误差在 $10^{-5}$ 以内均算正确。 ### 数据范围和提示 $3 \le n \le 10^5,1 \le m \le 10^6,|x|,|y| \le 10^6$ by Rainy7 & Piwry

题目描述

Byteasar is the king of Byteotia, an island in The Ocean of Happiness. The island is a convex shape, and all the towns of Byteotia are located on the shore. One of these towns is Byteburg, the famous capital of Byteotia. Every pair of towns is connected by a road that goes along the line segment between the towns. Some roads that connect different pairs of towns intersect - there is a crossroad at each such intersection. Bitratio, Byteasar's rival to the throne, had hatched a sordid plot. While Byteasar was travelling from the capital to an adjacent town, Bitratio's people seized Byteburg. Now Byteasar has to return to Byteburg as soon as possible in order to restore his rule. Unfortunately, some of the roads are controlled by Bitratio's guerrilla. Byteasar cannot risk the use of such roads, he can however cross them at the crossroads. Needless to say, he has to travel along the roads and hence turn only at the crossroads, for otherwise the journey would take far too long. Byteasar's loyal servants have informed him which roads are safe. Byteasar believes your loyalty, and thus entrusts you with a task to find the shortest safe route from the town he is currently in to Byteburg. Byteotia岛屿是一个凸多边形。城市全都在海岸上。按顺时针编号1到n。任意两个城市之间都有一条笔直的道路相连。道路相交处可以自由穿行。有一些道路被游击队控制了,不能走,但是可以经过这条道路与未被控制的道路的交点。问从城市1到n的最短距离。

输入输出格式

输入格式


In the first line of the standard input two integers ![](http://main.edu.pl/images/OI16/wsp-en-tex.1.png) and ![](http://main.edu.pl/images/OI16/wsp-en-tex.2.png) are given (![](http://main.edu.pl/images/OI16/wsp-en-tex.3.png), ![](http://main.edu.pl/images/OI16/wsp-en-tex.4.png)), separated by a single space, that denote respectively: the number of towns and the number of roads controlled by Bitratio's guerrilla. Let us number the towns from ![](http://main.edu.pl/images/OI16/wsp-en-tex.5.png) to ![](http://main.edu.pl/images/OI16/wsp-en-tex.6.png) starting from Byteburg and moving clockwise along the shore. Bytesar is currently in the town no. ![](http://main.edu.pl/images/OI16/wsp-en-tex.7.png). Each of the following ![](http://main.edu.pl/images/OI16/wsp-en-tex.8.png) lines holds a pair of integers ![](http://main.edu.pl/images/OI16/wsp-en-tex.9.png) and ![](http://main.edu.pl/images/OI16/wsp-en-tex.10.png) (![](http://main.edu.pl/images/O…

输出格式


Your programme is to print out one floating point number to the standard output: the length of the shortest safe route leading from the town no. ![](http://main.edu.pl/images/OI16/wsp-en-tex.19.png) to Byteburg. The absolute difference between the number returned and the correct one has to be at most ![](http://main.edu.pl/images/OI16/wsp-en-tex.20.png).

输入输出样例

输入样例 #1

6 9
-12 -10
-11 6
-4 12
6 14
16 6
18 -2
3 4
1 5
2 6
2 3
4 5
3 5
1 3
3 6
1 6

输出样例 #1

42.0000000000

说明

spj-