Manacher + 回文树
qq_37383726
这个作者很懒,什么都没留下…
展开
-
最长回文子串 【朴素算法(枚举)】
回文串是指aba、abba、cccbccc、aaaa这种左右对称的字符串。 输入一个字符串Str,输出Str里最长回文子串的长度。 Input 输入Str(Str的长度 <= 1000) Output 输出最长回文子串的长度L。 Sample Input daabaac Sample Output 5 思路: 朴素算法 ,我们可以枚举处于中间的数是哪个,对于aba型的,枚举b(原创 2017-04-27 01:07:47 · 430 阅读 · 0 评论 -
Mirrored String II 【最长回文子串】
Note: this is a harder version of Mirrored string I.The gorillas have recently discovered that the image on the surface of the water is actually a reflection of themselves. So, the next thing for them原创 2017-08-21 14:55:25 · 396 阅读 · 0 评论 -
[回文树 模板]
解决回文的有力武器 BZOJ 3676 题目大意:考虑一个只包含小写拉丁字母的符串s。我们定义s的一个子串 t的“出现值”为t在s中的出现次数乘以t的长度。 请你求出s的所有 回文子串中的最大出现值。 代码 #include &lt;bits/stdc++.h&gt; using namespace std; typedef long long ll; const int N = 30001...原创 2018-10-22 22:25:24 · 169 阅读 · 0 评论 -
[UVA7041 ] The Problem to Slow Down You [回文树]
题目链接 题意:给出两个仅包含小写字符的字符串 A 和 B ; 求:对于 A 中的每个回文子串,B 中和该子串相同的子串个数的总和。 分析:建两颗回文树,然后从0和1节点分别并行dfs扫下去 Code #include &lt;bits/stdc++.h&gt; using namespace std; typedef long long ll; const int N = 200000 + 1...原创 2018-10-23 10:48:04 · 375 阅读 · 2 评论