![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串 -------- 后缀数组
SolarDomo
每天都被头像萌醒
展开
-
后缀数组 资料
http://blog.csdn.net/jokes000/article/details/7839686原创 2016-08-08 23:49:45 · 241 阅读 · 0 评论 -
POJ 1743 Musical Theme 后缀数组
题目链接:http://poj.org/problem?id=1743题意:求序列中最长不重叠重复字串二分答案#include <cstdio> #include <cstring> //#include <iostream> #include <algorithm> #include <vector> #define sf scanf #define pf printf using namespa原创 2016-09-07 16:23:03 · 193 阅读 · 0 评论 -
POJ 3261 Milk Patterns 后缀数组 二分答案
题目链接:http://poj.org/problem?id=3261题意:在序列中求连续可重复至少出现了K次的最长的子串我们将height数组更加二分的答案分组,一个分组里面的后缀个数就是有某个子串出现的次数代码:#include <cstdio> #include <cstring> #include <algorithm> #include <vector> #define sf scanf原创 2016-09-07 20:23:09 · 293 阅读 · 0 评论 -
SPOJ 694 Distinct Substrings 后缀数组
题目链接:http://www.spoj.com/problems/DISUBSTR/题意:求一个字符串中有多少个不相同的字串 每一个子串都是字符串的一个后缀的前缀,这样问题就变为N个字符串有多少个不相同的前缀 按照sa[1],sa[2]….,sa[N]的顺序来考虑后缀 加入sa[i]时 一定有height[i]个前缀已经在前面被计数过 二期sa[i]的长度大于height[i]的前缀在前原创 2016-09-07 21:09:55 · 227 阅读 · 0 评论 -
SPOJ 705 New Distinct Substrings 后缀数组
题目链接:http://www.spoj.com/problems/SUBST1/和SPOJ 694 一样代码如下:#include <cstdio> #include <cstring> #define sf scanf #define pf printf using namespace std; const int maxn = 50000 + 5;int wa[maxn],wb[maxn],w原创 2016-09-07 21:15:26 · 263 阅读 · 0 评论 -
后缀数组 倍增算法模板
int wa[maxn],wb[maxn],wv[maxn],ws[maxn]; int cmp(int *r,int a,int b,int l) {return r[a]==r[b]&&r[a+l]==r[b+l];} void da(int *r,int *sa,int n,int m) { int i,j,p,*x=wa,*y=wb,*t; for(i=0;i<m;i++) ws[i]=0;原创 2016-08-19 10:42:08 · 846 阅读 · 1 评论