
数据结构--Manacher
淼润淽涵
这个作者很懒,什么都没留下…
展开
-
HDU3294 Girls' researc(Manacher-----如何在预处理的情况下输出最长回文串)
Problem Description One day, sailormoon girls are so delighted that they intend to research about palindromic strings. Operation contains two steps: First step: girls will write a long string (only ...原创 2019-11-16 18:14:14 · 178 阅读 · 0 评论 -
HDU 3613 Best Reward (Manacher变形)
Problem Description After an uphill battle, General Li won a great victory. Now the head of state decide to reward him with honor and treasures for his great exploit. One of these treasures is a nec...原创 2019-11-16 17:22:49 · 154 阅读 · 0 评论 -
HDU 4513 吉哥系列故事——完美队形II(Manacher变形)
Problem Description 吉哥又想出了一个新的完美队形游戏! 假设有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ... h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形: 1、挑出的人保持原队形的相对顺序不变,且必须都是在原队形中连续的; 2、左右对称,假设有m个人形成新的队形,则第1个人...原创 2019-11-16 15:34:25 · 149 阅读 · 0 评论 -
最长回文子串(Manacher算法----时间复杂度O(n) )
简介 马拉车算法是一种在O(n)时间内求一个字符串的最长回文子串的算法 思路 对于最长回文子串,我们可以有很多朴素算法 比如穷举所有子串,然后验证这些子串是否是回文的,这样的复杂度是O(n^3) 比如我们遍历数组,对于每一个元素,我们都认为其是某个回文子串的中心,我们同时向两边伸展,然后取其中的最大值,这样的算法的复杂度是O(n^2) 马拉车算法就是在方法2的基础上进行了扩展,...原创 2019-10-27 21:21:45 · 1109 阅读 · 0 评论