#P2559. [AHOI2002] 哈利·波特与魔法石
[AHOI2002] 哈利·波特与魔法石
Description

Input Format
The first line of the input file contains seven numbers, namely . The second line contains two numbers: the starting city and the destination city . The third line contains a positive integer , with , indicating that each of the following lines stores a pair of cities that are directly reachable from each other.
The information for a pair of directly reachable cities consists of three numbers: the indices of the two cities and the terrain type between these two cities. City indices are positive integers not exceeding , but the indices are not necessarily continuous.
On the same line in the file, any two adjacent numbers are separated by a single whitespace character.
Output Format
Output a single line with the time required by the fastest route between the starting city and the destination city .
0 1 0 0 0 0 0
1 4
4
1 2 1
1 3 1
2 4 2
3 4 3
5
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号