#t512. 最短路径问题
最短路径问题
Shortest Path on the Plane
Special for beginners, ^_^
Problem Description
There are points on the plane (), each with coordinates in the range . Some pairs of points are connected by lines.
If there is a connection, one point is reachable from the other; that is, there is a path between the two points, and the length of that path is the straight-line distance between them.
The task now is to find the shortest path from one point to another.
Input Format
The input contains lines in total:
The first line is the integer .
Lines through (exactly lines) each contain two integers and , describing the coordinates of one point.
Line is an integer , the number of connections in the graph.
The following lines each describe one connection, consisting of two integers and , meaning there is a connection between point and point .
The last line: two integers and , the source point and the destination point respectively.
Output Format
One line, a real number (rounded to two decimal places): the length of the shortest path from to .
Sample Input 1
5
0 0
2 0
2 2
0 2
3 1
5
1 2
1 3
1 4
2 5
3 5
1 5
Sample Output 1
3.41
Constraints
1s, 1024KiB for each test case.