最短路专题2 | CodeForces 449B - SPFA算法

最短路专题2 | CodeForces 449B - SPFA算法

B. Jzzhu and Cities

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 m roads connecting the cities. One can go from city u i u_i ui to v i v_i vi (and vise versa) using the i i i-th road, the length of this road is x i x_i xi. Finally, there are k train routes in the country. One can use the i i i-th train route to go from capital of the country to city s i s_i si (and vise versa), the length of this route is y i y_i yi.
J是A国的总统,这个国家有n个城市。1是首都,有m条公路连接这些城市。然后,有k个火车线。城市 s i s_i si到首都1的距离是 y i y_i 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.
J不想浪费钱,删除部分铁路,但是每个城市到达首都的最短路径不能被修改,也就是说,只有最短路径不经过这个铁路时,才可以删除。

Input

The first line contains three integers n ,   m ,   k ( 2   ≤   n   ≤   105 ; 1   ≤   m   ≤   3 ⋅ 105 ; 1   ≤   k   ≤   105 ) n, m, k (2 ≤ n ≤ 105; 1 ≤ m ≤ 3·105; 1 ≤ k ≤ 105) n,m,k(2

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值