随笔分类 -  *字符串---ac自动机

摘要:Wireless Password HDU - 2825 ac自动机 + 状压DP dp[i][j][k]表示 长度为i在节点j包含串状态为k时的方案数 dp[i][j][k | s] += dp[i-1][u][k] , 其中u是j的父节点, s是走到j节点时新加入的串的状态 1 #include 阅读全文
posted @ 2017-10-13 12:36 yijiull 阅读(220) 评论(0) 推荐(0)
摘要:Passwords Gym - 101174E ac自动机 + DP 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int sigma = 26; 4 const int maxnode = 1010; 5 const int m 阅读全文
posted @ 2017-10-12 17:47 yijiull 阅读(230) 评论(0) 推荐(0)
摘要:Censored! POJ - 1625 ac自动机 + 高精度 + dp 1 #include <iostream> 2 #include <queue> 3 #include <cstring> 4 #include <cstdio> 5 #include <algorithm> 6 using 阅读全文
posted @ 2017-10-12 08:11 yijiull 阅读(225) 评论(0) 推荐(0)
摘要:Searching the String ZOJ - 3228 题意:两种查询,普通的就是ac自动机模板,另外一种要求没有发生覆盖。 处理方式是判断一下如果当前匹配到的位置(u)减去上一次匹配到的位置(ed[u])大于该字符的深度(deep[u]),就加1。 1 #include <bits/std 阅读全文
posted @ 2017-08-18 10:55 yijiull 阅读(201) 评论(0) 推荐(0)
摘要:DNA repair HDU - 2457 题意:有些DNA序列是致病的,给你以个长DNA序列,问最少需要修改多少次使得其不含致病序列。 好多题解说的不清不楚的。。。最关键的地方往往没说清楚。。。 首先是进行了一步转换,将其理解为在建好的Trie图上走len(序列长度)步,走的路不能包含致病序列。 阅读全文
posted @ 2017-08-18 10:54 yijiull 阅读(307) 评论(0) 推荐(0)
摘要:考研路茫茫——单词情结 HDU - 2243 题意: 和上一题基本差不多 比较坑的是,矩阵快速幂的时候m+1了,会爆int,所以要用long long 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define ull unsigned l 阅读全文
posted @ 2017-08-18 10:52 yijiull 阅读(182) 评论(0) 推荐(0)
摘要:DNA Sequence POJ - 2778 题意: 昨天看了好久也没明白咋回事。。。今天忽然就理解了。。。 晚上再来补题解。。。 昨天看了好久也没明白咋回事。。。今天忽然就理解了。。。 晚上再来补题解。。。 1 #include <iostream> 2 #include <cstdio> 3 阅读全文
posted @ 2017-08-18 10:51 yijiull 阅读(163) 评论(0) 推荐(0)
摘要:病毒侵袭持续中 HDU - 3065 题意:统计长串中各短串出现的次数。 唯一需要注意的地方是,虽然短串只有大写英文字母,但是长串是可显示的字符,ASCII码是从32到127。 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define C 阅读全文
posted @ 2017-08-18 10:48 yijiull 阅读(185) 评论(0) 推荐(0)
摘要:病毒侵袭 HDU - 2896 题意:统计长串中出现了哪些短串 用vector存一下,再输出 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define CLR(m,a) memset(m,a,sizeof(m)) 4 5 const in 阅读全文
posted @ 2017-08-18 10:46 yijiull 阅读(139) 评论(0) 推荐(0)
摘要:Dominating Patterns UVALive - 4670 题意:给n个短串1个长串,问这个长串中出现次数最多的短串,并输出 学习了lrj不用指针的写法 需要注意的是模板串可能有重复,用map搞一下 1 #include <bits/stdc++.h> 2 using namespace 阅读全文
posted @ 2017-08-18 10:40 yijiull 阅读(153) 评论(0) 推荐(0)
摘要:Dominating Patterns UVALive - 4670 题意:给n个短串1个长串,问这个长串中出现次数最多的短串,并输出 题解:here 病毒侵袭 HDU - 2896 题意:统计长串中出现了哪些短串 题解:here 病毒侵袭持续中 HDU - 3065 题意:统计长串中各短串出现的次 阅读全文
posted @ 2017-07-28 11:05 yijiull 阅读(132) 评论(0) 推荐(0)