摘要: Description: 给出n个01串,求是否存在一个无限长度的01串不包含这n个中任意一个串 Solution: 若该串合法,则截取其循环的部分,相当于在所有01串中没有匹配,即不经过任一01串的末尾标记 所以只要在Trie图上找到一个不经过任何病毒串结尾位置的环即可 cpp include u 阅读全文
posted @ 2019-02-15 22:34 cloud_9 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Description: 输出有哪些模式串在文本串中出现次数最多,这个次数是多少 Hint: 多组数据,$ len_{文本串} using namespace std; const int mxn=2e6+5; char p[160][80],str[mxn]; int n,st[mxn],vis[ 阅读全文
posted @ 2019-02-15 22:21 cloud_9 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Description: 求$ \sum_{i=1}^{n} \sum_{j=1}^m gcd(i,j)^k ​$ Hint: $n,m using namespace std; const int mod=1e9+7,mxn=5e6+5; int T,k,n,m,tot; int f[mxn],g 阅读全文
posted @ 2019-02-15 13:36 cloud_9 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Description: 求n个模式串中有几个在文本串中出现 Solution: 模板,详见代码: cpp include using namespace std; const int mxn=1e7+5; char str[mxn],p[80]; queue q; namespace Trie { 阅读全文
posted @ 2019-02-15 11:47 cloud_9 阅读(95) 评论(0) 推荐(0) 编辑
摘要: Description 给你一个n个点的森林,要求支持m个操作: 1.连接两个点 x,y 2.询问若断掉 x,y这条边,两点所在联通块乘积的大小 Hint: $n,m using namespace std; const int mxn=1e5+5; int n,m,t[mxn],fa[mxn],s 阅读全文
posted @ 2019-02-15 08:26 cloud_9 阅读(173) 评论(0) 推荐(0) 编辑