回文自动机+性质优化 DP。时间复杂度 级别。思路详见:https://oi-wiki.org/string/pam/ 。 // /* By:Luckyblock */ #include <bits/stdc++.h> #define LL long long const int kN = 5e5 + 10; char s[kN]; int n, f[kN], g[kN]; //============================================================= //=======================================...