Musical Theme poj1743(后缀数组)】的更多相关文章

Musical Theme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 16757   Accepted: 5739 Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the…
[POJ1743]Musical Theme(后缀数组) 题面 洛谷,这题是弱化版的,\(O(n^2)dp\)能过 hihoCoder 有一点点区别 POJ 多组数据 题解 要求的是最长不可重叠重复子串 也就是找两个最长的相同子串 使得它们不相交 先求出\(SA,height\) 考虑一下如果两个子串相同 那么也就是两个后缀的前缀相同 还是一样吧. 二分答案,长度为\(K\) 那么,现在要找的就是连续长度不小于\(K\)的\(height\) 如果一段连续的\(height\)都不小于\(K\)…
                                                    Musical Theme 人生第一道后缀数组的题,采用大众化思想姿势极其猥琐. 题意:给你n个数,问其中是否存在一个子序列,这个子序列加上或者减去一个数与另一个子序列一样.要求两个子序列不能有重叠的部分.求这个子序列最长的长度. 思路:有点像KMP,先将所有的数之间的差(再加上88)存在一个数组中,然后对这个数组进行构造后缀数组.我们知道height[]数组的含义是:排名为i的这个后缀与排名…
A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that this representation of melodies ignores the notion of musical timing; b…
Musical Theme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 35044   Accepted: 11628 Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the…
  [题目链接] http://poj.org/problem?id=1743     [题意]     求不可重叠最长重复子串.   2015-11-27 [思路] 1)      据题意处理字符串 2)      后缀数组.二分长度k,问题成为了判定是否存在两个及以上长度不小于k且互不重叠的子串.根据height数组划分后缀,满足两个条件:一是一组内height值不小于k(保证组内任两个长度不小于k即存在长度不小于k的子串),二是组内后缀sa值的最大最小值之差大于等于k(保证两个子串不重叠)…
永恒的大牛,kuangbin,膜拜一下,Orz 链接:http://www.cnblogs.com/kuangbin/archive/2013/04/23/3039313.html Musical Theme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 14334   Accepted: 4945 Description A musical melody is represented as a sequence of…
题目冲鸭:http://poj.org/problem?id=1743 Musical Theme Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 36590   Accepted: 12087 Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1…
Musical Theme   Description A musical melody is represented as a sequence of N (1<=N<=20000)notes that are integers in the range 1..88, each representing a key on the piano. It is unfortunate but true that this representation of melodies ignores the…
题意:有n个数值,算出相邻两个值的差值,此时有n-1个值的序列,把这序列当做字符串的话,求最长重复子串,且这两个子串不能重叠. 分析:后缀数组解决.先二分答案,把题目变成判定性问题:判断是否存在两个长度为k 的子串是相同的,且不重叠. 只能说后缀数组很强大 PS:刚好是男人八题之一..........8分之1男人了....... #include <cstdio> #include <iostream> #include <cstring> #include <a…