随笔分类 -  AC自动机

摘要:题目链接 AC自动机 由于输入的是恶心的数字,用了map强行带log…… 由于不清楚长度,用了vector强行增加时间…… 由于要判重,用了数组存下强行加常数…… 慢惨了 1 #include<algorithm> 2 #include<iostream> 3 #include<cstdlib> 4 阅读全文
posted @ 2016-03-01 20:39 HugeGun 阅读(228) 评论(1) 推荐(0)
摘要:题目链接 构造AC自动机 BFS更新答案 由于做完fail后有BFS序,直接用就可以了 1 #include<algorithm> 2 #include<iostream> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cstdio> 6 #i 阅读全文
posted @ 2016-02-29 21:40 HugeGun 阅读(144) 评论(0) 推荐(0)
摘要:题目链接 如果可以按照一个循环节一直循环而不会被匹配到,那么就安全了 所以在AC自动机上找环就可以了 为什么会T呢?找环挂了,开两个bool数组快很多啊。。。涨姿势了 T掉代码: bool bo[30030]; bool dfs(int x) { bo[x]=1; re(i,0,1) { if(bo 阅读全文
posted @ 2016-02-29 16:06 HugeGun 阅读(190) 评论(0) 推荐(0)
摘要:题目链接 AC自动机+DP 有点像GT考试,hh[i][j]表示第i为匹配到自动机上j号结点的方案数 1 #include<algorithm> 2 #include<iostream> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cstdi 阅读全文
posted @ 2016-02-29 08:41 HugeGun 阅读(245) 评论(0) 推荐(0)