题目链接:https://www.luogu.com.cn/problem/P3449 Johnny 喜欢玩文字游戏。 他写下了 nn 个回文串,随后将这些串两两组合,合并成一个新串。容易看出,一共会有 n2n2 个新串。 两个串组合时顺序是任意的,即 a 和b 可以组合成 ab 和ba,另外自己和自己组合也是允许的。 现在他想知道这些新串中有多少个...
We want to take the value of function NumPal(s) which is the number of different palindromes that can be created using the string S by the above method. If the same palindrome occurs more than once then all of them should be counted separately. 输入输出格式 输入格式: The string S. 输出...
SP7586 NUMOFPAL Number of Palindromes 题意翻译 求一个串中包含几个回文串 输入输出格式 输入格式: The string S. 输出格式: The value of function NumPal(s). 说明 $ 0 include const int N=2
【SP7586】NUMOFPAL - Number of Palindromes 题面 https://www.luogu.org/problem/SP7586 题解 #include<cstdio>#include<iostream>#include<cstring>#defineri register int#defineN 11000050#defineuLL unsigned long longusingnamespacestd;chars0[N];chars1[N<<1];intn;inthw[N<<1],maxr,mid;intmain...
输入一个字符串SS Output 包含的回文串的个数. 看到题解里面有人人写回文自动机. 有必要那么麻烦嘛 emmm 我们直接跑ManacherManacher就好了啊. 答案就是以每一位为中心的回文串长度/2的和。 (如果添加字符则为回文半径长度/2。) 这个就不多解释了.很明显的一个东西。
【CodeChef-TREEPAL】Tree Palindromes 题意 字符树,每个点的值为到根这个字符串最长回文串长度,求所有点权和 做法 由于PAM复杂度是均摊的,不能直接做 每次找fail时,都是找到一个最长的后缀,满足后缀前一个字符能匹配上 就记录一下节点xx后接cc的往上跳应该在的位置...