#P1339. [USACO09OCT] Heat Wave G
[USACO09OCT] Heat Wave G
Description
Given an undirected graph with vertices and edges, find the length of the shortest path from to .
Input Format
The first line contains four positive integers .
The next lines each contain three positive integers , indicating an edge connecting and with length .
Output Format
Output one line containing a single integer, the answer.
7 11 5 4
2 4 2
1 4 3
7 2 2
3 4 3
5 7 5
7 3 3
6 1 1
6 3 4
2 4 3
5 6 3
7 2 1
7
Hint
Constraints
For of the testdata, , , .
Sample Explanation
is the shortest path, with length .
Translated by ChatGPT 5
京公网安备 11011102002149号