【模板】spfa
摘要:int dis_spfa[maxn]; bool vis_spfa[maxn]; queue<int>q_spfa; void spfa(int x) { mem(dis_spfa, 0x3f); mem(vis_spfa, false); dis_spfa[x] = 0; q_spfa.push(
阅读全文
posted @
2019-10-30 17:29
thjkhdf12
阅读(99)
推荐(0)
【分层图最长路,spfa】P1073 最优贸易
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib>
阅读全文
posted @
2019-10-30 17:28
thjkhdf12
阅读(110)
推荐(0)
【分层图最短路,dijstra】P2939 [USACO09FEB]改造路Revamping Trails
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib>
阅读全文
posted @
2019-10-24 14:33
thjkhdf12
阅读(85)
推荐(0)
【dij+dp】P1772 [ZJOI2006]物流运输
摘要:1 #include<iostream> 2 #include<string> 3 #include<queue> 4 #include<stack> 5 #include<vector> 6 #include<map> 7 #include<cstdio> 8 #include<cstdlib>
阅读全文
posted @
2019-10-22 19:12
thjkhdf12
阅读(105)
推荐(0)
【模板】dijstra
摘要:typedef struct { bool operator ()(const intpair& a, const intpair& b)const { return a.second > b.second; } }cmp_dij; int dis_dij[maxn]; bool vis_dij[m
阅读全文
posted @
2019-10-22 13:19
thjkhdf12
阅读(148)
推荐(0)
【DFS模拟SPFA】P1993 小K的农场
摘要:1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 #include<vector> 5 using namespace std; 6 7 vector<pair<int,int>>nextval[10010]; 8 bo
阅读全文
posted @
2019-10-09 13:44
thjkhdf12
阅读(113)
推荐(0)
P1346 电车
摘要:1 #include<iostream> 2 #include<queue> 3 #include<cstring> 4 using namespace std; 5 6 int cost[201]; 7 int g[201][201]; 8 int n, b, e; 9 int temp[1];
阅读全文
posted @
2019-10-09 13:32
thjkhdf12
阅读(115)
推荐(0)
【SPFA】P1462 通往奥格瑞玛的道路
摘要:1 #include<cstdio> 2 #include<algorithm> 3 #include<iostream> 4 using namespace std; 5 #define INF 0x3f3f3f3f 6 using namespace std; 7 8 int n, m, k;
阅读全文
posted @
2019-10-09 13:32
thjkhdf12
阅读(116)
推荐(0)
P1339 [USACO09OCT]热浪Heat Wave
摘要:1 #include<iostream> 2 #include<cstring> 3 #include<queue> 4 using namespace std; 5 6 int g[2501][2501]; 7 int n; 8 int m; 9 int be; 10 int en; 11 int
阅读全文
posted @
2019-10-09 13:30
thjkhdf12
阅读(97)
推荐(0)