Manacher
Jerry99s
OI -> ACM -> AI
展开
-
HDU3068 最长回文 (Manacher)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=3068 分析: Manacher模板题 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll; const int tmax=1100005; int len,id,p[tmax*2]; char...原创 2018-08-10 20:31:07 · 128 阅读 · 0 评论 -
HDU 3613. Best Reward (扩展KMP/Manacher)
题目: http://acm.hdu.edu.cn/showproblem.php?pid=3613 题意: 给定一个字符串s; 每个字符有一个权值; 砍成两段,若某段为回文串则其价值为各字符的价值和,非回文串则价值为0; 问两段的价值和最大是多少。 分析: 法一: 做完Manacher,枚举砍点就是了。 法二: 设给定字符串为s,将其反转后为t; 以s为文本串,t为模板串跑exKMP,得到ext...原创 2019-08-06 15:12:17 · 353 阅读 · 0 评论