随笔分类 -  模板

摘要:注意有两个变量 now是判断x是不是根,并不是父节点 #include<bits/stdc++.h> using namespace std; const int maxn = 100005; struct edge{ int to, next; }e[maxn << 1]; int head[ma 阅读全文
posted @ 2019-11-13 21:53 ATKevin 阅读(115) 评论(0) 推荐(0)
摘要:记住了l,r #include<bits/stdc++.h> using namespace std; const int maxn = 1e5+10; struct edge{ int to, nxt; }e[maxn]; int head[maxn], cnt; int n, m, x, y, 阅读全文
posted @ 2019-11-12 22:30 ATKevin 阅读(197) 评论(0) 推荐(0)
摘要:#include<bits/stdc++.h> using namespace std; const int maxn = 1e5+10; const int inf = 0x3f3f3f3f; struct edge{ int to, nxt; }e[maxn << 1]; int head[ma 阅读全文
posted @ 2019-11-12 21:40 ATKevin 阅读(120) 评论(0) 推荐(0)
摘要:记住体积倒序,因为每组只能取一个 #include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> #include<algorithm> #include<string> using namespace std; int d 阅读全文
posted @ 2019-11-11 21:46 ATKevin 阅读(191) 评论(0) 推荐(0)
摘要:二进制优化 #include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cmath> using namespace std; const int maxn = 25000; const int 阅读全文
posted @ 2019-11-11 21:00 ATKevin 阅读(97) 评论(0) 推荐(0)
摘要:#include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<algorithm> using namespace std; long a, k, p, n; long quc(long a, long 阅读全文
posted @ 2019-11-10 15:10 ATKevin 阅读(92) 评论(0) 推荐(0)
摘要:迪杰斯特拉+堆优化 #include<bits/stdc++.h> using namespace std; const int MAXN = 100005; const int MAXM = 200005; struct edge{ int to, next; long long w; }e[MA 阅读全文
posted @ 2019-11-10 10:25 ATKevin 阅读(118) 评论(0) 推荐(0)
摘要:prim:给出一个无向图,求出最小生成树,如果该图不连通,则输出impossible。 #include<bits/stdc++.h>using namespace std;const int maxm = 200005;const int inf = 0x3f3f3f3f;struct edge{ 阅读全文
posted @ 2019-10-01 13:27 ATKevin 阅读(186) 评论(0) 推荐(0)
摘要:并查集(路径压缩) // luogu p3367 并查集板子#include<bits/stdc++.h> using namespace std; int n, m, z, x, y; int f[10005]; int find(int x) { if(x == f[x]) return x; 阅读全文
posted @ 2019-09-12 19:34 ATKevin 阅读(129) 评论(0) 推荐(0)