摘要:
残量网络: 由 剩余容量边和反向平衡流量 的边构成 dinic算法(省去了建图与s,t) 复杂度 O(n^2 *m) const int N =1e6+4, M =5*N ; const int inf =1e15+7; int all=1,hd[N],go[M],w[M],nxt[M]; int 阅读全文
posted @ 2022-10-25 23:31
towboat
阅读(24)
评论(0)
推荐(0)
摘要:
floy 找圈 #include <iostream> #include <vector> #include <map> #include <cstring> using namespace std; const int N=300; int a[N][N],vis[N],n,m; int tot; 阅读全文
posted @ 2022-10-25 22:53
towboat
阅读(25)
评论(0)
推荐(0)
摘要:
求图上苗条度(最大边 - 最小边) 最小的生成树 像kruskal 一样,给边排序,枚举L,R 区间,更新答案 #include <iostream> #include <cstring> #include <algorithm> using namespace std ; const int M= 阅读全文
posted @ 2022-10-25 21:20
towboat
阅读(15)
评论(0)
推荐(0)
摘要:
kmp+字典树 #include <iostream> #include <cstring> #include <queue> using namespace std ; const int N=1e4+2,M=1e6+2; char s[M]; int val[N]; int ch[N][30], 阅读全文
posted @ 2022-10-25 18:22
towboat
阅读(24)
评论(0)
推荐(0)
摘要:
找字符串的最短循环节 1. kmp #include <bits/stdc++.h> using namespace std ; const int N=1e6+1; char a[N]; int n,p[N]; void init(){ int i,j=0; for(i=1;i<n;i++){ w 阅读全文
posted @ 2022-10-25 13:47
towboat
阅读(27)
评论(0)
推荐(0)
摘要:
一个字符串,它是由某个字符串不断自我连接形成的。但是这个字符串是不确定的,现在只想知道它的最短长度是多少。 #include <iostream> using namespace std ; const int N=1e6+1; char a[N]; int n,p[N]; void init(){ 阅读全文
posted @ 2022-10-25 13:44
towboat
阅读(23)
评论(0)
推荐(0)
摘要:
关于字符串匹配问题 比如A,B串,现在要在A中找B 扫描A串,并更新能匹配到B的什么位置 关于kmp算法如何工作,有经典说法 神犇解说 摘选 我们用两个指针i和j分别表示,A[i-j+ 1..i]与B[1..j]完全相等。也就是说,i是不断增加的,随着i的增加j相应地变化,且j满足以A[i]结尾的长 阅读全文
posted @ 2022-10-25 00:52
towboat
阅读(21)
评论(0)
推荐(0)