Bryce1010模板 http://acm.timus.ru/problem.aspx?space=1&num=1960 #include <bits/stdc++.h> using namespace std; const int maxn = 100010; struct PalindromicTree{ int fail[maxn],len[maxn],son[maxn][26]; int tot,last,n; char s[maxn]; int newnode(int sl…
 Palindromes and Super Abilities Problem's Link: http://acm.timus.ru/problem.aspx?space=1&num=1960 Mean: 给你一个长度为n的字符串S,输出S的各个前缀中回文串的数量. analyse: 回文树(回文自动机)的模板题. 由于回文自动机中的p是一个计数器,也相当于一个指针,记录的是当前插入字符C后回文树中有多少个节点. 那么我们只需要一路插,一路输出p-2就行. p-2是因为一开始回文树中就有两个…
http://acm.timus.ru/problem.aspx?space=1&num=1960 题意:给一个串s,要求输出所有的s[0]~s[i],i<|s|的回文串数目.(|s|<=10^5) #include <bits/stdc++.h> using namespace std; struct PT { static const int nS=26, nL=100015, N=nL; int f[N], l[N], c[N][nS], id[N], s[nL],…
Palindromes and Super Abilities Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on Ural. Original ID: 196064-bit integer IO format: %lld      Java class name: (Any) After solving seven problems on Timus Online Judge with a word “…
URAL - 1960   Palindromes and Super Abilities 回文树水题,每次插入时统计数量即可. #include<bits/stdc++.h> using namespace std; #define eps 1e-9 #define For(i,a,b) for(int i=a;i<=b;i++) #define Fore(i,a,b) for(int i=a;i>=b;i--) #define lson l,mid,rt<<1 #d…
Palindromes and Super Abilities 2 Time Limit: 1MS   Memory Limit: 102400KB   64bit IO Format: %I64d & %I64u Status Description Dima adds letters s1, -, sn one by one to the end of a word. After each letter, he asks Misha to tell him how many new pali…
2040. Palindromes and Super Abilities 2 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=2040 Description Dima adds letters s1, -, sn one by one to the end of a word. After each letter, he asks Misha to tell him how many new palindrome substrings a…
Palindromes and Super Abilities 2 题目链接: http://acm.hust.edu.cn/vjudge/contest/126823#problem/E Description Dima adds letters s 1, -, s n one by one to the end of a word. After each letter, he asks Misha to tell him how many new palindrome substrings…
[CF245H]Queries for Number of Palindromes(回文树) 题面 洛谷 题解 回文树,很类似原来一道后缀自动机的题目 后缀自动机那道题 看到\(n\)的范围很小,但是\(Query\)很多 所以提前预处理出每一段\(l,r\)的答案 时间复杂度\(O(n^2+Q)\) #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #includ…
[SPOJ]NUMOFPAL - Number of Palindromes(Manacher,回文树) 题面 洛谷 求一个串中包含几个回文串 题解 Manacher傻逼题 只是用回文树写写而已.. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> #include<…