摘要: https://nanti.jisuanke.com/t/15428 题目大意:离散表示的字符串,求其最长回文串长度。 解题关键:若只用Manacher算法,在统计sum时会超时,所以加一个树状数组来维护前n项和,即可AC。 注意进行Manacher时,i是从1开始的,不要小也不要大。 n天后更新: 阅读全文
posted @ 2017-05-16 18:06 Elpsywk 阅读(154) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3068 题目大意:求最长回文串的长度。 解题关键:Manacher算法 引用一个较好的解释 可以这么说,这行要是理解了,那么马拉车算法基本上就没啥问题了,那么这一行代码拆开来看就是 如果mx > i, 则 p[i] 阅读全文
posted @ 2017-05-16 16:53 Elpsywk 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 typedef long long ll; 4 struct trie{ 5 int count; 6 trie *next[26]; 7 }*root; 8 trie *newtrie(){ 9 trie *t=(trie *)malloc(sizeof(struct tr... 阅读全文
posted @ 2017-05-16 01:21 Elpsywk 阅读(356) 评论(0) 推荐(0) 编辑