tavas专题

codeforces535D:Tavas and Malekas(KMP)

(i-1 , i)有重合的时候 ,从第i位开始的子串必须是模式串的前缀。 而同时,从第i位开始的子串本来就已经是模式串的后缀了。 typedef long long LL ;const int maxn = 1000008 ;int next[maxn] ;void getnext(char s[]){int len = strlen(s) ;next[0] = -1 ;i

codeforces535D Tavas and Malekas kmp

题目链接 题意:给定字符串s的长度n, x1, x2, ...xk中选取m个位置           给定字符串p            y1, y2, ..., ym             x1, x2, ...xk中每个xi满足sxisxi + 1...sxi + |p| - 1 = p            求满足条件的字符串有多少种,对10^9+7取模 思路:首先对字符串