Codeforces Round #257 (Div. 2)D(最短路Dijkstra+堆优化)
来源:互联网 发布:r软件下载 编辑:程序博客网 时间:2024/06/08 18:24
Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are mroads connecting the cities. One can go from city ui to vi (and vise versa) using the i-th road, the length of this road is xi. Finally, there are k train routes in the country. One can use the i-th train route to go from capital of the country to city si (and vise versa), the length of this route is yi.
Jzzhu doesn't want to waste the money of the country, so he is going to close some of the train routes. Please tell Jzzhu the maximum number of the train routes which can be closed under the following condition: the length of the shortest path from every city to the capital mustn't change.
The first line contains three integers n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105).
Each of the next m lines contains three integers ui, vi, xi (1 ≤ ui, vi ≤ n; ui ≠ vi; 1 ≤ xi ≤ 109).
Each of the next k lines contains two integers si and yi (2 ≤ si ≤ n; 1 ≤ yi ≤ 109).
It is guaranteed that there is at least one way from every city to the capital. Note, that there can be multiple roads between two cities. Also, there can be multiple routes going to the same city from the capital.
Output a single integer representing the maximum number of the train routes which can be closed.
5 5 31 2 12 3 21 3 33 4 41 5 53 54 55 5
2
2 2 31 2 22 1 32 12 22 3
2
- Codeforces Round #257 (Div. 2)D(最短路Dijkstra+堆优化)
- Codeforces Round #372 (Div. 2) -- D. Complete The Graph(Dijkstra单源最短路)
- Codeforces Round #302 (Div. 2) D. Destroying Roads(最短路)
- Codeforces Round #302 (Div. 2)D. Destroying Roads-最短路
- Codeforces Round #302 (Div. 2) D bfs最短路
- Codeforces Round #372 (Div. 2) D. Complete The Graph 图论、最短路、Dijkstra、路径、分配部分边权
- Codeforces Round #257 div.2 D or 450D Jzzhu and Cities【最短路】
- Codeforces Round #257 (Div. 2) D Jzzhu and Cities 最短路
- Codeforces Round #257 (Div. 2) D题:Jzzhu and Cities 删特殊边的最短路
- Codeforces Beta Round #95 (Div. 2) D. Subway(环最短路)
- Codeforces Round #420 (Div. 2) D. Okabe and City (最短路)
- Codeforces Round #420 (Div. 2) D. Okabe and City(最短路)
- CodeForces 601A The Two Routes(dijkstra最短路)——Codeforces Beta Round #333 (Div.1 Div. 2)
- Codeforces 715B & 716D Complete The Graph 【最短路】 (Codeforces Round #372 (Div. 2))
- Codeforces Round #103 (Div. 2)---D. Missile Silos(最短路+枚举边)
- 08/13 D -> codeforces Round #Pi div 2 E. President and Roads 最短路变形
- Codeforces Round #408 (Div. 2) D. Police Stations 最短路、BFS
- Codeforces Round #420 (Div. 2) D. Okabe and City 最短路
- Partition List 二分链表(重)
- UDP协议来快速无丢失传输图像程序
- Codeforces 383C . Propagating tree【树状数组,dfs】
- newLISP 递归访问目录树
- HDU 4588 统计二进制加法进位次数
- Codeforces Round #257 (Div. 2)D(最短路Dijkstra+堆优化)
- 菜鸟学51单片机之----在笔记本上模拟PC和51串口通信2
- 一张图让你明白Android Touch事件的传递机制
- 如何修复ubuntu启动时显示的“The System Running In Low Graphics Mode’ Error”问题
- ghigh
- 找工作准备
- 6离开了好看回家狂欢
- 美丽号结构化价格惠
- 美丽同一天人依然天涯