难得的ZJOI水题...DFS一遍就行了... ----------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<cctype> using namespace std; const int maxn = 500009; int N = 0,…
http://www.lydsy.com/JudgeOnline/problem.php?id=4034 dfs序,树链剖分 #include<cstdio> #include<iostream> using namespace std; #define N 100001 typedef long long LL; int n,a[N]; ],to[N<<],tot; int fa[N],siz[N],dep[N]; int bl[N]; int id,L[N],R[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…