![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
丽尔巴茨
这个作者很懒,什么都没留下…
展开
-
p3808 ac自动机模板
ac自动机模板 #include <stdio.h> #include <string.h> #include <algorithm> #include <queue> using namespace std; const int maxn=1e6+7; int trie[maxn][26],idx,val[maxn],fail[maxn]; ch...原创 2019-08-19 09:24:59 · 73 阅读 · 0 评论 -
p3375 kmp匹配算法模板
#include <stdio.h> #include <string.h> using namespace std; const int maxn=1e6+7; int nxt[maxn]; char s1[maxn],s2[maxn]; int n,m; int main() { scanf("%s%s",s1+1,s2+1);n=strlen(s1+1),...原创 2019-08-15 20:08:54 · 170 阅读 · 0 评论 -
P3041AC自动机+dp
第一道ac自动机加dp的题目 1a了很开心 据说ac自动机的dp都是有套路的,就是状态表示大都是2维,dp[i][j],表示串匹配了i个,最后一位停留在了trie图的j号点上了 这题是模板题, 以下给出ac代码 #include <stdio.h> #include <string.h> #include <algorithm> #include <que...原创 2019-08-21 06:24:36 · 160 阅读 · 0 评论 -
p4824 kmp算法的运用
kmp算法的灵活运用 #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; const int maxn=1e6+7; char s[maxn],t[maxn]; int nxt[maxn]; int stk[maxn],top,p[maxn]; int...原创 2019-08-21 10:00:34 · 118 阅读 · 0 评论 -
p3121 ac自动机的运用
比较裸的ac自动机的运用 以下给出ac代码 #include <stdio.h> #include <string.h> #include <algorithm> #include <queue> using namespace std; const int maxn=1e5+7; int trie[maxn][26],cnt,fail[maxn]...原创 2019-08-22 01:44:53 · 156 阅读 · 0 评论 -
p3805manacher算法模板
manacher算法模板 用于求字符串最大回文子串的算法,其思想和kmp有异曲同工之妙,都是先暴力,再利用已有信息来降低复杂度 时间复杂度为O(n) 空间复杂度为O(n) #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; const int maxn...原创 2019-08-17 04:03:31 · 117 阅读 · 0 评论