随笔分类 -  Ac自动机

摘要:从天上掉下来了个这样的问题: 有一个字符串 从中选出两个子串 A,B,求 A+B可以构成的不同串的个数。 还想知道,这么多个串中字典序最大的那一个。 某人捡到了这个问题,并把它扔给了你。 【输入】 一个全由小写字母构成的字符串。 【输出】 第一行 一个非负整数,表示两个子串A+B可以构成的不同串个数 阅读全文
posted @ 2017-09-27 19:09 友人Aqwq 阅读(232) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n,m,ans,id[505],vis[105000]; char s[255],T[10005]; struct node{ int a[ 阅读全文
posted @ 2017-05-27 21:19 友人Aqwq 阅读(130) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n,m,ans,id[505],vis[105000]; char s[255],T[10005]; struct node{ int a[ 阅读全文
posted @ 2017-05-25 13:53 友人Aqwq 阅读(196) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int size=26,M=1000005; char c[M]; int w[255],n; struct node{ int sum 阅读全文
posted @ 2017-05-23 18:12 友人Aqwq 阅读(219) 评论(0) 推荐(0)