10 2019 档案
摘要:#include<bits/stdc++.h> using namespace std; const int maxn = 500005; struct edge{ int next, to; }e[maxn << 1]; int head[maxn], cnt; int n, m, s, a, b, xx, yy; int depth[maxn], fa[maxn][22]; void add(
阅读全文
摘要:先注意初始化dp[], 后注意预处理dp[1]等 例如 acwing 1018最低通行费中没有初始化dp[][],和预处理dp[1][0],dp[0][1]
阅读全文
摘要:https://www.acwing.com/blog/content/32/ 1.n≤30, 指数级别, dfs+剪枝,状态压缩dp2.n≤100=> O(n^3), floyd(图论),dp3.n≤1000=> O(n^2),O(n ^2 logn), dp,二分4.n≤10000=> O(n
阅读全文
摘要:prim:给出一个无向图,求出最小生成树,如果该图不连通,则输出impossible。 #include<bits/stdc++.h>using namespace std;const int maxm = 200005;const int inf = 0x3f3f3f3f;struct edge{
阅读全文