随笔分类 -  DFS

【codeforces 19/11/06 div2】D. 0-1 MST
摘要:1 #include<iostream> 2 #include<set> 3 #include<map> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 8 const int maxn = 100010; 9 int 阅读全文
posted @ 2019-11-09 00:17 thjkhdf12 阅读(143) 评论(0) 推荐(0)
【IDA*】P2324 [SCOI2005]骑士精神
摘要:1 #include<iostream> 2 #include<cstdio> 3 using namespace std; 4 5 int g[6][6] = 6 { 7 {0,0,0,0,0,0}, 8 {0,1,1,1,1,1}, 9 {0,0,1,1,1,1}, 10 {0,0,0,2,1, 阅读全文
posted @ 2019-10-30 10:30 thjkhdf12 阅读(108) 评论(0) 推荐(0)
【树形DP】P2014 选课
摘要: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 13:42 thjkhdf12 阅读(114) 评论(0) 推荐(0)
【树形DP】P2015 二叉苹果树
摘要: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-23 18:45 thjkhdf12 阅读(105) 评论(0) 推荐(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) 推荐(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)