随笔分类 -  图的遍历

【纯思考】P1268 树的重量
摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int n; 6 int dis[35][35]; 7 8 int main() 9 { 10 while (cin >> n) 11 { 12 if (!n) 阅读全文
posted @ 2019-10-09 13:40 thjkhdf12 阅读(109) 评论(0) 推荐(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) 推荐(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) 推荐(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) 推荐(0)
【记忆化+判环】P2921 [USACO08DEC]在农场万圣节Trick or Treat on the Farm
摘要:1 #include <iostream> 2 using namespace std; 3 4 int n; 5 int nextval[100010]; 6 int sum[100010]; 7 int circle[100010]; 8 int mark; 9 bool vis[100010] 阅读全文
posted @ 2019-10-09 13:28 thjkhdf12 阅读(110) 评论(0) 推荐(0)
【欧拉回路】P1341 无序字母对
摘要:1 #include<iostream> 2 #include<string> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 7 bool edge[127][127]; 8 int n; 9 int h; 10 阅读全文
posted @ 2019-10-09 13:27 thjkhdf12 阅读(105) 评论(0) 推荐(0)
【染色法】P1330 封锁阳光大学
摘要:1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 using namespace std; 5 6 struct Edge 7 { 8 int n; 9 int next; 10 }edge[100010]; 11 阅读全文
posted @ 2019-10-09 13:26 thjkhdf12 阅读(104) 评论(0) 推荐(0)
P2661 信息传递
摘要:1 #include<iostream> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 6 int nextval[200010]; 7 int fcnt[200010]; 8 bool vis1[200010] 阅读全文
posted @ 2019-10-09 13:25 thjkhdf12 阅读(108) 评论(0) 推荐(0)