后缀数组
hexianhao
这个作者很懒,什么都没留下…
展开
-
hdu 3518
题意:找出一个字符串中至少重复出现两次的字串的个数,注意重复出现时不能有重叠的现象 解题思路:height[i]表示排名第i的后缀与排名第i-1的后缀的最长公共前缀,然后我们可以枚举长度为k(1 AC: #include #include #include #include #include using namespace std; const int maxn = 1005; int s转载 2016-01-18 18:47:50 · 350 阅读 · 0 评论 -
hdu 2459
题意:让你求一个串中连续重复次数最多的串(不重叠),如果重复的次数一样多的话就输出字典序小的那一串。 我的解题思路:这个题目很明显就是后缀数组的运用,我首先是枚举长度,然后判断该长度下是否可以找到重复子串。关键是如何来找,我是这样算的,首先判断sa[i-1]和sa[i]的最长公共前缀,如果长度大于等于枚举的那个长度,就说明有可能这两个串是有重复的部分,接下来看这两个串的位置差,如果也等于原创 2016-01-21 16:37:28 · 550 阅读 · 0 评论 -
hdu 5442 Favorite Donut(后缀数组)
Favorite Donut Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Problem Description Lulu has a sweet tooth. Her favorite food is ring donut. Everyday she原创 2016-06-08 21:33:50 · 267 阅读 · 0 评论 -
hdu 1403
Longest Common Substring Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Description Given two strings, you have to tell the length of the Longest Co原创 2016-01-16 19:58:02 · 542 阅读 · 0 评论 -
poj 3261 Milk Patterns(后缀数组)
Milk Patterns Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 14130 Accepted: 6263 Case Time Limit: 2000MS Description Farmer John has noticed that th原创 2016-08-23 20:56:24 · 277 阅读 · 0 评论 -
poj 1743 Musical Theme(后缀数组)
Musical Theme Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 26471 Accepted: 8936 Description A musical melody is represented as a sequence of N (1<=N<=20原创 2016-08-23 23:31:03 · 321 阅读 · 0 评论