| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 (추가 시간 없음) | 2048 MB | 28 | 24 | 19 | 82.609% |
Every student knows the practice: after having had one too many drinks in the \PUB, you will go to the Doner Shop to treat yourself with some comfort food.
But experience tells you that you and your friends will not recall the way to the Doner Shop when you are drunk. Besides there are a lot of Doner Shops in the city. Therefore you decide to write a program that will tell you how far away the nearest Doner store is from your current location. And tells you with Doner store is closest.
You may assume you can reach at least one Doner Shop from your current location. You always start at the crossing numbered 1.
A line with two integers: $N, 1 < N \le 10000,ドル the number of crossings in the city, and $S, 1 < S \le 100000,ドル the number of streets in the city.
$S$ lines with three space seperated integers, $a, b, l, 1 \le a, b \le N , 1 \le l \le 1000$. Which indicate that a street with length $l$ connects crossing a with crossing b. All streets are bi-directional.
An integer $m, 1 \le m \le 1000,ドル the number of Doner Shops in the city.
$M$ lines with one integer $c, 1 \le c \le N$ which indicates that on crossing $c$ you can find a Doner shop.
One line with two space separated integers:
$C$ The number of the crossing at which you can find the closest Doner Shop. If multiple doner stores are equally far away from you, give the one that has the lowest number.
$L$ The length of the shortest route to the closest Doner Shop.
6 6 1 2 5 1 5 1 5 3 2 2 3 1 2 4 1 3 6 3 2 4 6
4 5
11 13 1 2 5 2 3 30 2 4 16 4 3 17 2 5 6 5 6 7 6 10 8 10 9 12 8 9 11 8 11 14 7 8 10 1 7 9 5 8 13 3 11 10 3
10 26