#P1744. 采购特价商品
采购特价商品
Description
There are shops everywhere along Zhongshan Road, which has become a point of no return for the shopaholic guru "Love-and-Sorrow" (Ai Yu Chou). There are () shops on Zhongshan Road, and each shop’s coordinates lie between and . Among them, there are roads connecting pairs of shops. If there is a road, you can travel from one shop to the other, and the length of the road is the straight-line distance between the two points. Now the guru "Love-and-Sorrow" wants to find the shortest distance between two shops. Can you help compute it?
Input Format
A total of lines:
The first line: an integer .
The next lines: each line contains two integers and , giving the coordinates of a shop.
The next line: an integer .
The next lines: each line describes a road, consisting of two integers and , indicating there is a road between shop and shop .
The next line: two integers and , indicating the source shop and the target shop, respectively.
Output Format
A single line: a real number (rounded to two decimal places), representing the length of the shortest path from to .
5
0 0
2 0
2 2
0 2
3 1
5
1 2
1 3
1 4
2 5
3 5
1 5
3.41
Hint
Constraints: For of the testdata: , , .
Translated by ChatGPT 5
京公网安备 11011102002149号