
Manacher
creator平
期望破茧成蝶时的飞翔,向往突破蝉蛹后的鸣叫。
展开
-
POJ - 3974(Manacher算法)
Andy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algorithm to find the length of the lar...原创 2018-04-04 18:55:10 · 366 阅读 · 0 评论 -
HDU - 3068——最长回文
给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等 Input 输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len <= 110000 ...原创 2018-05-11 11:21:18 · 348 阅读 · 0 评论 -
HDU - 3613——Best Reward (分割回文串最大权值)
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 necklace made up of 26 d...原创 2018-05-12 08:26:11 · 591 阅读 · 0 评论 -
HDU - 4513——吉哥系列故事――完美队形II
吉哥又想出了一个新的完美队形游戏! 假设有n个人按顺序站在他的面前,他们的身高分别是h[1], h[2] ... h[n],吉哥希望从中挑出一些人,让这些人形成一个新的队形,新的队形若满足以下三点要求,则就是新的完美队形: 1、挑出的人保持原队形的相对顺序不变,且必须都是在原队形中连续的; 2、左右对称,假设有m个人形成新的队形,则第1个人和第m个人身高相同,第2个人和第m-...原创 2018-05-12 09:47:18 · 133 阅读 · 0 评论 -
HDU - 3294——Girls' research (最长回文位置+字符转换)
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 contains lower case) ...原创 2018-05-12 11:01:28 · 271 阅读 · 0 评论 -
洛谷 P3805 【模板】manacher算法
题目链接:https://www.luogu.org/problem/P3805/*洛谷 P3805 【模板】manacher算法给出一个字符串,求回文长度aaaans:3*/#include<bits/stdc++.h>#define M 11000010using namespace std;char S[M],new_S[M];int p[2*M],t...原创 2019-09-25 15:40:23 · 164 阅读 · 0 评论 -
洛谷 P3649 [APIO2014]回文串(回文树)
题目链接:https://www.luogu.org/problem/P3649回文树的作用:求串S前缀0~i内本质不同回文串的个数 求串S内每一个本质不同回文串出现的次数 求串S内回文串的个数(其实就是1和2结合起来) 求以下标i结尾的回文串的个数 #include<bits/stdc++.h>#define M 300010using namespace st...原创 2019-09-26 21:33:48 · 257 阅读 · 0 评论