回文自动机与等差数列
CF932G Palindrome Partition Given a string \(s\) , find the number of ways to split \(s\) to substrings such that if there are \(k\) substrings \((p_1, p_2, p_3, \dots, p_k)\) in partition, then \(p_i = p_{k - i + 1}\) for all \(i (1 ≤ i ≤ k)\) and \(k\) is even. Since the number of ways can be large, print it modulo \(10^9 + 7\) . \(2 ≤ |s| ≤ 10^6\) . 题解 详细证明见 A bit more about palindromes ,这里只有配图的感性理解。 题目转化 题目划分成偶数段的要求很奇怪,不过有一个转化。 考虑 \(p_i\) 和 \(p_{k-i+1}\) 两个子串,如果 \(p_i\) 对应的下标区间是 \([pos,pos+len-1]\) ,那么 \(p_{k-i+1}\) 对应的就是 \([n-pos-len+2,n-pos+1]\) 。 下面举一些例子来感性理解。当 \(pos=1\) 的时候, \[ s_1=s_