摘要:
题目 前缀和+记忆化搜索的方法: 时间复杂度:\(O(10^{2} L^{2})\)(\(L\)为数字位数) #include<bits/stdc++.h> using namespace std; long long a,b,f[25][25],dig[20];//f[pos][k]:记忆化数组, 阅读全文
摘要:
题目 最小生成树模板 Kruskal: 时间复杂度:\(O(M\log M)\) #include<bits/stdc++.h> using namespace std; int N,M,f[5010],ans; struct node{ int X,Y,Z; }e[200010]; bool cm 阅读全文
摘要:
题目 差分约束模板 时间复杂度:\(O(nm)\) #include<bits/stdc++.h> using namespace std; const int N=5005; int n,m,hd[N],ver[2*N],nxt[2*N],w[2*N],tot,dis[N],cnt[N]; boo 阅读全文
摘要:
题目 负环模板 时间复杂度:\(O(Tnm)\) #include<bits/stdc++.h> using namespace std; const int N=3005; int T,n,m,hd[N],ver[2*N],nxt[2*N],w[2*N],tot,dis[N],cnt[N];//c 阅读全文
摘要:
一些简单的模板 快速幂模板 题目 时间复杂度:\(O(\log b)\) #include<bits/stdc++.h> using namespace std; long long a,b,p; long long qp(long long a,long long b,long long p){ 阅读全文