Hotaru's problem】的更多相关文章

Hotaru's problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3314    Accepted Submission(s): 1101 Problem Description Hotaru Ichijou recently is addicated to math problems. Now she is playin…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5371 题意:把一个数字串A翻过来(abc翻过来为cba)的操作为-A,我们称A-AA这样的串为N-sequence,现在给你一个数字串,问你这个串中最长的N-sequence子串长度 解:可以想到A-A是一个回文串,-AA也是一个回文串,那么首先Manacher跑一遍求出所有回文子串 可以想到任意两个互相覆盖串中心点的回文子串都可以表示成N-sequence 然后大概有三种搞法: 1.时间复杂度O(…
Hotaru's problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1765    Accepted Submission(s): 635 Problem Description Hotaru Ichijou recently is addicated to math problems. Now she is playing…
题目链接: Hdu 5371 Hotaru's problem 题目描述: 给出一个字符串N,要求找出一条N的最长连续子串.这个子串要满足:1:可以平均分成三段,2:第一段和第三段相等,3:第一段和第二段回文. 解题思路: 其实通俗来讲就是求符合题意的最长回文串.先用manacher与处理一下字符串N,得出以n[i]与n[i+1]为中心的回文串长度半径记为p[i],然后循环枚举i作为第一段的终点,p[i]+i-1作为第二段的终点记做j.当p[i]>=(j-i+1)&&p[j]>…
题目传送门 /* 题意:求形如(2 3 4) (4 3 2) (2 3 4)的最长长度,即两个重叠一半的回文串 Manacher:比赛看到这题还以为套个模板就行了,因为BC上有道类似的题,自己又学过Manacher算法,结果入坑WA到死 开始写的是判断是否 p[i]-1 <= p[i+p[i]-1]-1,但是没有想到这种情况:5 (5 1) (1 5) (5 1) 1 单靠最长回文半径是不行的,看了网上的解题报告知道,要从极端位置往回挪才行 给我的教训是只会套模板是没用的,要灵活的使用该算法.另…
Hotaru's problem Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 907    Accepted Submission(s): 322 Problem Description Hotaru Ichijou recently is addicated to math problems. Now she is playing…
本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/转载请注明出处,侵权必究,保留最终解释权!   Problem Description Hotaru Ichijou recently is addicated to math problems. Now she is playing with N-sequence.Let's define N-s…
Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 2189    Accepted Submission(s): 774 Problem Description Hotaru Ichijou recently is addicated to math problems. Now she is playing with N-sequence…
HDU   5371 Description Hotaru Ichijou recently is addicated to math problems. Now she is playing with N-sequence. Let's define N-sequence, which is composed with three parts and satisfied with the following condition: 1. the first part is the same as…
题意:给出一个数字串,询问最长的子串,满足以下要求:将子串平均分为三部分,一三部分相等,一二部分对衬. /* 在manachar的基础上,枚举回文串的中心,再找第三部分. */ #include<cstdio> #include<iostream> #define M 200010 using namespace std; int s[M],a[M],p[M],len; void Manancher(){ ; a[l++]=-; a[l++]=-; ;i<len;i++){…