![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
后缀数组
tyg_zx
这个作者很懒,什么都没留下…
展开
-
后缀数组poj2774
//这个可以看做事后缀数组的模板了,我对后缀数组还不是很了解,现在还是很肤浅的认识 现在只认识到了后缀数组的的一个重要的优化是由于基数排序,基数排序的时间复杂度的为O (nlog(r)m),其中r为所采取的基数,而m为堆数; 而且是不会写模板呀!! #include #include #include using namespace std; const int maxn=200005;原创 2015-02-06 16:03:12 · 429 阅读 · 0 评论 -
poj1743
//楼教主的男人八题之一,大致的是搞懂了,但是还是有些小细节不懂 #include #include #include using namespace std; const int maxn=20010; int wa[maxn],wb[maxn],wsf[maxn],wv[maxn],sa[maxn]; int rank[maxn],height[maxn],s[maxn]; int cmp原创 2015-02-07 22:38:40 · 443 阅读 · 0 评论 -
poj3261
//和poj1734差不多。我是在poj1734的基础上修改了一下然后就直接AC的 #include #include #include using namespace std; const int maxn=20010; int wa[maxn],wb[maxn],wsf[maxn],wv[maxn],sa[maxn]; int rank[maxn],height[maxn],s[maxn]原创 2015-02-08 02:43:58 · 413 阅读 · 0 评论 -
la4513
//刘汝佳书上的用hash来写的,感觉有点拼人品呀,和X的取值的关系很大的 #include #include #include #include using namespace std; const int maxn=40005; const int x=99; int rank[maxn]; unsigned long long h[maxn],xp[maxn],hash[maxn]; i原创 2015-02-10 00:31:22 · 683 阅读 · 0 评论 -
HDU3518
//具体的文章分析可以看这个http://www.acmerblog.com/hdu-3518-boring-counting-6479.html #include #include #include using namespace std; const int maxn=1100; int wa[maxn],wb[maxn],wsf[maxn],wv[maxn],sa[maxn]; int原创 2015-02-21 17:40:09 · 659 阅读 · 0 评论 -
后缀数组的一些问题
1:求重复次数不小于K 的最长不重叠子串; 这种题的思路解法是利用height数组的来分组,另外在增加一个queue数组来对每个分组里面的数组进行排序,在加以判断,另外需要看下N的范围大小,如果n》=10000话最好还是用DC3构造法,如果不是的话可以用倍增法,例题见hdu2890 2:求有多少子串重复次数大于2,且不重叠,还是一样利用height数组来分组在每次分组完毕的时候判断一下最大值和原创 2015-02-24 15:11:19 · 465 阅读 · 0 评论 -
POJ2217
//是看了别人的代码才AC的。我的代码是有问题的 先 上我的代码 #include #include #include using namespace std; const int maxn=10000*2+20; int wa[maxn],wb[maxn],wsf[maxn],wv[maxn],sa[maxn]; int rank[maxn],height[maxn],s[maxn]; c转载 2015-02-10 20:39:19 · 406 阅读 · 0 评论 -
hdu2890
//这题貌似只能用DC3构造法。因为N实在是太大了 //WA了很多发,蛋疼 //http://www.acmerblog.com/hdu-2890-longest-repeated-subsequence-4533.html #include #include #include #include #include using namespace std; const原创 2015-02-23 21:18:22 · 477 阅读 · 0 评论