随笔分类 -  字符串-后缀数组

摘要:http://poj.org/problem?id=2406题意:给定一个字符串 L,已知这个字符串是由某个字符串 S 重复 R 次而得到的,求 R 的最大值。(长度#include #include #include #include using namespace std;int p[20000... 阅读全文
posted @ 2015-01-13 14:16 iwtwiioi 阅读(253) 评论(0) 推荐(0) 编辑
摘要:http://www.spoj.com/problems/DISUBSTR/题意:求字符串不同子串的数目。#include using namespace std;const int N=1005;void sort(int *x, int *y, int *sa, int n, int m) { ... 阅读全文
posted @ 2015-01-13 13:14 iwtwiioi 阅读(148) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=3261题意:一个长度为n的串,要求最长的子串的长度且这个子串的出现次数不少于k次。(1#include using namespace std;const int N=20015;void sort(int *x, int *y, int *sa... 阅读全文
posted @ 2015-01-12 22:01 iwtwiioi 阅读(241) 评论(0) 推荐(0) 编辑
摘要:http://poj.org/problem?id=1743题意:不可重叠最长重复子串,n#include using namespace std;const int N=20015;void sort(int *x, int *y, int *sa, int n, int m) { static ... 阅读全文
posted @ 2015-01-12 21:44 iwtwiioi 阅读(179) 评论(0) 推荐(0) 编辑
摘要:http://www.lydsy.com/JudgeOnline/problem.php?id=1031很容易想到这就是将字符串复制到自己末尾然后后缀数组搞出sa然后按区间输出即可。然后换了下模板,将基数排序放到外边#include #include #include #include #inclu... 阅读全文
posted @ 2014-11-13 12:54 iwtwiioi 阅读(438) 评论(0) 推荐(0) 编辑
摘要:http://www.lydsy.com/JudgeOnline/problem.php?id=1692http://www.lydsy.com/JudgeOnline/problem.php?id=1640很显然,我们取两边时,要取向右(左)拓展得到最小的(相同的情况下),如果不相同,显然取越小的... 阅读全文
posted @ 2014-09-06 16:17 iwtwiioi 阅读(322) 评论(0) 推荐(0) 编辑
摘要:对于概念去看白书或者论文吧(《后缀数组——处理字符串的有力工具》by:罗穗骞)这里放上模板,一些解释在注释里。#include #include #define for1(i,a,n) for(i=a;i=(n);--i)#define for4(i,a,n) for(i=a;i>(n);--i)#... 阅读全文
posted @ 2014-07-23 21:43 iwtwiioi 阅读(330) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示