摘要: #include <iostream> #include <cstring> #include <algorithm> using namespace std; const int N=100010,M=2*N; int n,m; struct edge{int v,ne;}e[M]; int h[ 阅读全文
posted @ 2025-10-02 16:25 xdhking 阅读(9) 评论(0) 推荐(0)
摘要: 模板洛谷p3311 code: #include<bits/stdc++.h> using namespace std; typedef long long LL; // 常量定义:N为AC自动机状态数上限、数位DP位数上限;mod为答案取模值 const int N=2010,mod=1e9+7; 阅读全文
posted @ 2025-09-25 22:42 xdhking 阅读(12) 评论(0) 推荐(0)
摘要: 模板:洛谷P5357 code: #include<bits/stdc++.h> using namespace std; const int N=2e5+10; int fail[N],tr[N][26],idx,n,times[N]; //end[i]表示第i个字符的结尾编号 int ed[N] 阅读全文
posted @ 2025-09-24 23:57 xdhking 阅读(6) 评论(0) 推荐(0)
摘要: 概念 树结构是n个顶点,n-1条边,如果多加一条边会变成一个图结构,此时这个图结构中只有一个环,这样的图称为基环树,即n 个点 n 条边的无重边无自环的连通无向图 code,模板洛谷P12145: #include<bits/stdc++.h> using namespace std; const 阅读全文
posted @ 2025-09-24 17:35 xdhking 阅读(20) 评论(0) 推荐(0)
摘要: code: const int N=110; const double eps=1e-7; int n; double a[N][N]; inline bool zero(double x){ return fabs(x)<eps; } int gauss(){ for(int i=1;i<=n;i 阅读全文
posted @ 2025-09-13 14:43 xdhking 阅读(12) 评论(0) 推荐(0)
摘要: 模板题:洛谷p1939 code: #include<bits/stdc++.h> using namespace std; typedef long long LL; const int N=5,mod=1e9+7; int n,siz=3; struct matrix{ LL m[N][N]; 阅读全文
posted @ 2025-09-13 14:28 xdhking 阅读(7) 评论(0) 推荐(0)
摘要: 模板题:洛谷P3375 code: 前缀函数解法 #include<bits/stdc++.h> using namespace std; const int N=2e6+10; string s,t; int n,m; int pi[N]; int main(){ cin>>s>>t; n=s.s 阅读全文
posted @ 2025-09-13 10:48 xdhking 阅读(12) 评论(0) 推荐(0)
摘要: 模板题:洛谷p3805 code: #include<iostream> #include<algorithm> using namespace std; const int N=2.2e7+10; string t,s; int m,n; int d[N]; int main(){ cin>>t; 阅读全文
posted @ 2025-09-13 10:21 xdhking 阅读(8) 评论(0) 推荐(0)
摘要: 概念 最大流: 从源点流向汇点的最大流量 增广路: 一条从源点到汇点的所有边的剩余容量>=0的路径 残留网: 由网络中所有结点和剩余容量大于0的边构成的子图,这里的边包括有向边和其反向边 模板题: 洛谷p3376 code: #include<iostream> #include<algorithm 阅读全文
posted @ 2025-09-13 00:27 xdhking 阅读(14) 评论(0) 推荐(0)
摘要: 概念 若一张无向连通图不存在割点,则称它为“点双连通图”。无向图的极大点双连通子图被称为“点双连通分量”。 tarjan算法求vDCC 用一个栈存点,若遍历回到x时,发现割点判定法则low[y]>=dfn[x]成立,则从栈中弹出节点,直到y被弹出。 刚才弹出的节点和x一起构成一个vDCC。 vDCC 阅读全文
posted @ 2025-09-12 20:35 xdhking 阅读(6) 评论(0) 推荐(0)