随笔分类 - 模板
摘要:注意有两个变量 now是判断x是不是根,并不是父节点 #include<bits/stdc++.h> using namespace std; const int maxn = 100005; struct edge{ int to, next; }e[maxn << 1]; int head[ma
阅读全文
摘要:记住了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,
阅读全文
摘要:#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
阅读全文
摘要:记住体积倒序,因为每组只能取一个 #include<iostream> #include<cstdlib> #include<cstdio> #include<cmath> #include<algorithm> #include<string> using namespace std; int d
阅读全文
摘要:二进制优化 #include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cmath> using namespace std; const int maxn = 25000; const int
阅读全文
摘要:#include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<algorithm> using namespace std; long a, k, p, n; long quc(long a, long
阅读全文
摘要:迪杰斯特拉+堆优化 #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
阅读全文
摘要:prim:给出一个无向图,求出最小生成树,如果该图不连通,则输出impossible。 #include<bits/stdc++.h>using namespace std;const int maxm = 200005;const int inf = 0x3f3f3f3f;struct edge{
阅读全文
摘要:并查集(路径压缩) // 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;
阅读全文

浙公网安备 33010602011771号