
最短路
吴俊达9812
这个作者很懒,什么都没留下…
展开
-
P3008 [USACO11JAN]道路和飞机Roads and Planes
思路1:SLF优化spfa水过 #include <bits/stdc++.h> using namespace std; const int maxn = 25005; const int maxm = 5000005; const int inf = 0x3f3f3f3f; int he[maxn],ver[maxm],ne[maxm],tot,cost[maxm]; ...原创 2019-10-22 20:49:54 · 210 阅读 · 2 评论 -
poj 3662
思路:spfa 转移dp #include <cstdio> #include <cstring> #include <utility> #include <queue> using namespace std; const int maxn = 1005; const int maxm = 20005; const int maxk = 10...原创 2019-10-22 19:03:56 · 142 阅读 · 0 评论 -
洛谷 P2939
题意:每天,农夫John需要经过一些道路去检查牛棚N里面的牛. 农场上有M(1<=M<=50,000)条双向泥土道路,编号为1..M. 道路i连接牛棚P1_i和P2_i (1 <= P1_i <= N; 1 <= P2_i<= N). John需要T_i (1 <= T_i <= 1,000,000)时间单位用道路i从P1_i走到P2_i或者从P2_...原创 2019-09-28 17:07:09 · 234 阅读 · 0 评论 -
codeforces 449B. Jzzhu and Cities
题意:一个图,其中一些边被打上了标记,找一个最短路树,使得树边包含的标记边最少。 思路:二维dijkstra。二维dijkstra的原理可以理解为dp,每个点的dp值都是最优的状态。转移时从最优的上一个状态进行转移。 #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair&l...原创 2019-09-29 14:59:38 · 104 阅读 · 0 评论