manacher最长回文子串
https://www.luogu.org/blog/codesonic/manacheralgorithm
先放上洛谷的链接,毕竟讲的真好
两道例题
luogu4555 SP7586
inline void change() { s[0]=s[1]='#'; for(int i=0; i<n; i++) { s[i*2+2]=a[i]; s[i*2+3]='#'; } n=n*2+2; s[n]=0; } //替换新串 inline void manacher() { int maxright=0,mid; for(int i=1; i<n; i++) { if(i<maxright) hw[i]=min(hw[(mid<<1)-i],hw[mid]+mid-i); else hw[i]=1; while(s[i+hw[i]]==s[i-hw[i]]) ++hw[i]; if(hw[i]+i>maxright) { maxright=hw[i]+i; mid=i; } } }//主函数更新答案
马拉车算法