用manacher找出本质不同的回文子串放在SAM上跑 #include<iostream> #include<cstdio> #include<cstring> #include<string> using namespace std; const int N=600005; int n,p[N]; char s[N],c[N]; long long ans; struct SAM { int la,cnt,pos[N],len[N],si[N],sa[N…
https://www.lydsy.com/JudgeOnline/problem.php?id=3676 回文自动机模板题 4年前的APIO如今竟沦为模板,,,╮(╯▽╰)╭,唉 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define N 300001 char ss[N]; int s[N]; ,last; int fail[N],len[N],cnt[N…
两道差不多的题,都是回文自动机right集合处理相关. Victor and String Victor loves to play with string. He thinks a string is charming as the string is a palindromic string. Victor wants to play n times. Each time he will do one of following four operations. add a char c to…