codeforces 808G Anthem of Berland

codeforces 808G Anthem of Berland

题面

给定(s)串和(t)串,字符集是小写字母。(s)串中有些位置的值不确定,要求你确定这些位置上的值,使得(t)(s)中出现次数最多,输出最多出现次数。

参考博客

http://www.cnblogs.com/Oncle-Ha/p/7061929.html

题解

AC自动机预处理 (ne[i][j]):字符串 (t[i]+j) 的后缀最长匹配到 (t[ne[i][j]])
状态(f[i][j])(s[i])的后缀最长匹配到(t[j]),并且(s[i])完美匹配(t)(f[i][j])次。

原文地址:https://www.cnblogs.com/wuyuanyuan/p/8278017.html