![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ac自动机
李祖林
这个作者很懒,什么都没留下…
展开
-
hdu 1277 全文检索
一般方法超时,后面用ac自动机做秒过,据说是数据太弱!!#includeusing namespace std;string str,st[10005],stt[10005];int k,flag,j;struct node{ node *next[10],*fail; int cnt,id; void init() {原创 2016-06-30 21:52:20 · 203 阅读 · 0 评论 -
hdu 3065 病毒侵袭持续中
记得释放内存,不然就会无限Memory Limit Exceeded,表示自己是过来人。#include#include#include#include#includeusing namespace std;char str1[2000100],str[1005][55];int a[1005],n,k;struct node{ int cnt,i原创 2016-06-30 09:59:02 · 200 阅读 · 0 评论 -
hdu 2896 病毒侵袭
代码写的不好但易懂!之前无限wrong,就是因为自己太粗心了!以后一定要谨慎!#include#include#include#include#includeusing namespace std;char str[1000100];int k,flag,kk,j,mm,nn;int a[505];struct node{ int cnt,id原创 2016-06-29 17:13:53 · 243 阅读 · 0 评论 -
hdu 2222 Keywords Search
第一道ac自动机题,ac自动机算法的理解(crazyacking的博客http://www.cnblogs.com/crazyacking/p/4002807.html +ppt(http://wenku.baidu.com/view/93af2c936bec0975f465e2f1.html))#includeusing namespace std;char str[1000100]原创 2016-06-27 21:51:43 · 264 阅读 · 0 评论 -
nyoj 题目1085 数单词
题目:输出出现次数最多的单词(有几个输出几个,而且按之前给的顺序输出),之前被题目误解了,以为只要重复出现就要输出!!还有就是题目说单词数量最多是150,结果我开到200才给过!!因此wrong了好多次!!!以后数组尽量开大些!解法:ac自动机模板题+map(单词可能会出现多次,这里要处理一下)!#includeusing namespace std;char str1[1000100原创 2016-08-05 10:31:40 · 221 阅读 · 0 评论