http://www.lydsy.com/JudgeOnline/problem.php?id=1131 dp[i]=dp[fa[i]]-son[i]+n-son[i] #include<cstdio> #include<iostream> using namespace std; #define N 1000001 ],nxt[N<<],tot; int fa[N]; bool vis[N]; int dep[N],son[N]; long long dp[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…