摘要: 题目链接难得出一个AC自动机,我还没做到这个题呢。。。这题思路不难想,小小的状压出一维来,不过,D和R,让我wa死了,AC自动机,还得刷啊。。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define MOD 1000000007 8 int dp[101][101][201][4]; 9 int trie[201][2]; 10 int o[201]; 11 int fail[201],que[1001],p[201][201]; 12 int t; 13... 阅读全文
posted @ 2013-09-25 14:27 Naix_x 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 这题确实很棒。。又是无想法。。其实是AC自动机+DP的感觉,但是只有一个串,用kmp就行了。dp[i][j][k],k代表前缀为virus[k]的状态,len表示其他所有状态串,处理出Ac[len][26]数组来,DP就可以了。状态转移那里一直没想清楚,wa了很多次,记录路径倒是不复杂,瞎搞搞就行。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 char s1[103],s2[103],virus[103]; 8 int dp[103][103][103]; 9 ... 阅读全文
posted @ 2013-09-25 10:06 Naix_x 阅读(804) 评论(8) 推荐(0) 编辑