最短路(Spfa)
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.
【题目描述】
给定 条边, 个点的带权无向图。求 到 的最短路。
【输入】
第一行:;
接下来行个正整数: 表示之间有一条长度为的路,。
【输出】
一个整数,表示 到 的最短距离。
【输入样例】
4 4
1 2 1
2 3 1
3 4 1
2 4 1
【输出样例】
2
【提示】
【样例解释】
注意图中可能有重边和自环,数据保证 到 有路径相连。
【来源】
一本通在线评测
C23暑假作业5-图论-基础题
- Status
- Done
- Problem
- 17
- Open Since
- 2024-7-5 0:00
- Deadline
- 2024-10-27 23:59
- Extension
- 24 hour(s)