【模板】Dijkstra-最短路
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
有一个 $n$ 个点 $m$ 条边的无向图,请求出从 $s$ 到 $t$ 的最短路长度。
Input Format
第一行四个正整数 $n,m,s,t$。
接下来 $m$ 行,每行三个正整数 $u,v,w$,表示一条连接 $u,v$,长为 $w$ 的边。
Output Format
输出一行一个整数,表示答案。
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
【数据范围】
对于 $100\%$ 的数据,$1\le n \le 10^5$,$1\le m \le 6200$,$1\le w \le 1000$。
【样例说明】
$5 \to 6 \to 1 \to 4$ 为最短路,长度为 $3+1+3 = 7$。
2025_07_09吉利学院暑假实训周-上机实践-9
- Status
- Done
- Rule
- XCPC
- Problem
- 8
- Start at
- 2025-7-9 14:00
- End at
- 2025-7-9 17:00
- Duration
- 3 hour(s)
- Host
- Partic.
- 25