![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
板子梳理
V4yne.
HDU18级新生,ACM菜狗。
展开
-
洛谷p3390 矩阵快速幂模板
题目链接 存一下矩阵快速幂的板子。= = AC代码: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=105; const int mo=1e9+7; ll n,m; struct ahaha { ll a[maxn][maxn]; //一定要用long long存矩阵,否则在过程中会爆掉 ahaha() { memset(a,0,sizeof a); }原创 2020-07-21 18:45:56 · 163 阅读 · 0 评论 -
网络流模板
Dinic最大流: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=5050; const int maxm=1e5+50; const int inf=0x3f3f3f3f; int n,m,s,t; ll maxflow;int vist; int vis[maxn]; int dep[maxn]; int cur[maxm]; struct node { int to,ne原创 2020-06-20 02:47:13 · 113 阅读 · 0 评论 -
V4yneの求lca的倍增模板
代码: const int maxn=1e5+50; vector<int> edge[maxn]; int rot;int dep[maxn]; int rec[maxn][30]; void dfs(int x,int fa) { rec[x][0]=fa; dep[x]=dep[fa]+1; for(int i=0;i<edge[x].size();i++) { ...原创 2020-06-20 02:51:03 · 264 阅读 · 0 评论 -
V4yne的模板----树的问题
1.求树的直径与两个端点。 (两遍dfs,son记录端点。) 2.换根dp求解树上每一个点为根时的最长链。 (dp,dp0是子树中最长值,dp1是子树中次长值,dp2是答案)。 3.最大或者最小的点覆盖或者边覆盖。 ...原创 2020-06-20 02:49:37 · 129 阅读 · 0 评论 -
V4yneの模板(总)
V4yneのACM模板---- 前向星模板 struct node { int to,next; }edge[2*maxn];//存储的是边,双向边之类,一般开边数*2 int e,head[maxn]; void edge_init() { memset(head,0,sizeof(head)); e=0; } void add_edge(int u,int v) { edge[++e]...原创 2020-06-20 02:48:49 · 176 阅读 · 0 评论