AC自动机
纵马且长歌
贪心过样例,暴力出奇迹,骗分最神奇,打表进省一
展开
-
AC自动机模板
(此模板来自于hdu2222题,纯属将其看作模板来上传的)代码:#include #include #include #include #include #include using namespace std;const int maxn=1e6+100;char str[maxn];struct node{int count ;struct node原创 2017-08-11 21:11:36 · 112 阅读 · 0 评论 -
hdu3065 病毒侵袭持续中(AC自动机)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3065题意:给你n个串,再给你一个大长串,问你之前的n个串中出现过的串的次数。解:AC自动机解决,使用vis数组记录当前字符串出现的次数。每当匹配成功则+1,最后输出非0的vis就行。关于AC自动机可看我的博客:AC自动机讲解+模板代码:#include #include原创 2017-09-19 09:14:14 · 486 阅读 · 0 评论 -
hdu5880 Family View (AC自动机)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5880题意:给你一些关键字,再给你一段文字,需要你将关键字屏蔽,换成‘*’;解:AC自动机解,记录下关键字的长度和出现的位置,再遍历输出一遍就好。(但问题是我在pos数组记录长度输出一直WA,,费解呀)代码:#include #include #include原创 2017-10-01 10:56:34 · 273 阅读 · 0 评论 -
hdu5384 Danganronpa (AC自动机)
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5384题目大意:给你一堆母串,还有另一堆子串,询问每个母串中出现的子串总次数。(子串计数可重叠)解:AC自动机模板题了,就是一个计数方法修改下就好。代码:#include #include #include #include #include #includ原创 2017-10-02 10:53:25 · 222 阅读 · 0 评论