【图的遍历】邻接表带权图
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.
题目描述
一个国家有n个城市编号为1至n,被已有的m条单向高速公路连接,每条高速公路有一个长度len。现在政府决定建造新的高速公路,在此之前,需要你将已有的公路信息存储并提供查询。一共将会有q次查询,每次查询一个城市x,输出所有以城市x为起点的公路信息。
输入格式
第一行3个整数n,m,q 接下来m行每行三个整数x,y,len 接下来q行,每行一个整数x
输出格式
对于每个查询,输出所有以x为起点的公路的终点和距离 输出时,后记录的边先输出。
样例 #1
样例输入 #1
4 4 3
1 2 3
1 2 4
1 2 5
3 4 1
1
3
4
样例输出 #1
2 5
2 4
2 3
4 1
提示
2025CSP-J 图【李】
- Status
- Done
- Problem
- 26
- Open Since
- 2025-10-1 0:00
- Deadline
- 2025-11-7 23:59
- Extension
- 24 hour(s)