![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
manacher
qq_38232157
这个作者很懒,什么都没留下…
展开
-
HOJ 4513 吉哥系列故事——完美队形II(manacher回文串变形)
manacher回文串变形 本题要点: 1、此题把回文串的条件加强了,条件有3个: a) 要求是回文串 b) 数值先递增,到了对称位置达到最大,然后递减。 2、 假如此类型的回文串叫做 “加强回文串”, 只需要在 manacher 函数里面, 改动一下 while 循环即可。 裸的 manacher算法, while 循环的条件 while(i - RL[i] >= 0 && i + RL[i] < len && ms[i - RL[i]] == ms[i + R原创 2020-08-23 17:57:03 · 81 阅读 · 0 评论 -
HOJ 3068 最长回文(manacher回文串,裸题)
manacher回文串,裸题 本题要点: 1、manacher算法,相对较容易理解。假如字符串的长度是 n, 该方法可以在 O(n)的时间内,求出最长的回文串的长度和具体的回文串 2、此题很裸。 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int MaxL = 120005; char s[Max原创 2020-08-23 17:39:34 · 59 阅读 · 0 评论 -
HOJ 5371 Hotaru‘s problem(manacher回文串变形)
manacher回文串变形 本题要点: 1、一段序列 s 分为 三段 (假设为 x, y, z 三段) x, y拼接起来 和 y,z 拼接起来都是回文串。 2、 用 manacher 算法,在 序列 s 的每个数字之间插入数字0, 得到 数组 ms(ms 数组的个数是 2 * n + 1) 用数组 RL[MaxN], RL[i]表示 数组ms 的第i个数的回文半径 + 1。 3、 假设当前符合条件的最大回文半径是 ans, 扫描数组 RL, 下标从2 开始。 for(int k = 2; k < m;原创 2020-08-23 17:34:12 · 70 阅读 · 0 评论