
后缀数组
clover_hxy
The secret oppotunities are hidden inside every failure....
展开
-
bzoj 1031: [JSOI2007]字符加密Cipher
1031: [JSOI2007]字符加密CipherTime Limit: 10 Sec Memory Limit: 162 MBSubmit: 5473 Solved: 2261[Submit][Status][Discuss]Description 喜欢钻研问题的JS同学,最近又迷上了对加密方法的思考。一天,他突然想出了一种他认为是终极的加密办法:把需要加原创 2016-04-17 17:08:30 · 657 阅读 · 0 评论 -
poj 3294 Life Forms (后缀数组)
Life FormsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 15125 Accepted: 4437DescriptionYou may have wondered why most extraterrestrial life forms rese原创 2016-12-29 10:22:43 · 266 阅读 · 0 评论 -
spoj 220 PHRASES - Relevant Phrases of Annihilation(后缀数组)
PHRASES - Relevant Phrases of Annihilationno tags You are the King of Byteland. Your agents have just intercepted a batch of encrypted enemy messages concerning the date of the planned a原创 2016-12-29 11:17:41 · 492 阅读 · 0 评论 -
poj 1226 Substrings (后缀数组)
SubstringsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 13919 Accepted: 4922DescriptionYou are given a number of case-sensitive strings of alphabetic原创 2016-12-29 19:26:47 · 510 阅读 · 0 评论 -
bzoj 3230: 相似子串 (后缀数组+RMQ+二分)
3230: 相似子串Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 1502 Solved: 364[Submit][Status][Discuss]DescriptionInput输入第1行,包含3个整数N,Q。Q代表询问组数。第2行是字符串S。接下来Q行,每行两个整数i和j。(1≤i≤j)。原创 2016-12-29 23:31:36 · 443 阅读 · 0 评论 -
poj 3415 Common Substrings (后缀数组+单调栈)
Common SubstringsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 10446 Accepted: 3444DescriptionA substring of a string T is defined as:T(i, k)=TiTi原创 2016-12-29 09:09:48 · 491 阅读 · 0 评论 -
bzoj 3879: SvT (后缀数组+单调栈)
3879: SvTTime Limit: 30 Sec Memory Limit: 512 MBSubmit: 546 Solved: 219[Submit][Status][Discuss]Description(我并不想告诉你题目名字是什么鬼)有一个长度为n的仅包含小写字母的字符串S,下标范围为[1,n].现在有若干组询问,对于每一个询问,我们给出若干个后缀原创 2017-01-12 08:05:14 · 616 阅读 · 0 评论 -
bzoj 4278: [ONTAK2015]Tasowanie (后缀数组)
4278: [ONTAK2015]TasowanieTime Limit: 10 Sec Memory Limit: 256 MBSubmit: 313 Solved: 140[Submit][Status][Discuss]Description给定两个数字串A和B,通过将A和B进行二路归并得到一个新的数字串T,请找到字典序最小的T。Input原创 2017-03-02 20:48:24 · 448 阅读 · 0 评论 -
bzoj 3796: Mushroom追妹纸 (后缀数组+KMP+二分)
题目描述传送门题目大意: 求一个字符串满足 1、w是s1的子串 2、w是s2的子串 3、s3不是w的子串 4、w的长度应尽可能大题解刚开始想用SAM做,想了半天发现不是很可做啊。 还是好好想后缀数组的做法吧。这道题最恶心的限制就是限制3:s3不是w的子串。 那么如果没有这个限制该怎么做呢?我们用间隔符连接s1,s2,用后缀数组求出height数组。答案一定出自相邻两个后缀的height原创 2017-03-28 16:25:21 · 820 阅读 · 0 评论 -
bzoj 4556: [Tjoi2016&Heoi2016]字符串 (主席树+二分+后缀数组+ST表||后缀自动机+线段树合并+LCA)
题目描述传送门题目大意:给出一个长度为n的字符串,每次询问[a,b]中的子串与[c,d]的最长公共前缀的长度的最大值题解对字符串建立后缀数组。我们知道两个后缀的最长公共后缀等于区间[rank[i]+1,rank[j]]的height的最小值,那么因为是取min,所以区间的长度越长答案肯定不可能更优。 建立主席树,将i插入到rank[i]的位置,然后在主席树中维护每个区间的最靠左/最靠右的位置。原创 2017-03-29 21:53:20 · 787 阅读 · 0 评论 -
bzoj 4698: Sdoi2008 Sandy的卡片 (后缀数组+二分)
题目描述传送门题解二分答案,判断是否有一段区间的height都大于当前答案,并且包含n个串中的每个串。代码#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>#define N 2000003using namespace std;int xx[N],yy[N],v[N原创 2017-04-18 09:15:31 · 370 阅读 · 0 评论 -
bzoj 2534: Uva10829L-gap字符串 (后缀数组+ST表)
题目描述传送门题目大意:有一种形如uvu形式的字符串,其中u是非空字符串,且V的长度正好为L,那么称这个字符串为L-Gap字符串 。 给出一个字符串S,以及一个正整数L,问S中有多少个L-Gap子串.题解同bzoj 2119: 股市的预测代码#include<iostream>#include<cstring>#include<algorithm>#include<cstdio>#incl原创 2017-04-21 15:10:55 · 554 阅读 · 0 评论 -
poj 3693 Maximum repetition substring (后缀数组+RMQ)
Maximum repetition substringTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9455 Accepted: 2913DescriptionThe repetition number of a string is defined a原创 2016-12-28 22:36:43 · 451 阅读 · 0 评论 -
poj 2406 Power Strings (后缀数组)
Power StringsTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 45998 Accepted: 19230DescriptionGiven two strings a and b we define a*b to be their concate原创 2016-12-28 20:04:52 · 763 阅读 · 2 评论 -
URAL 1297 Palindrome (后缀数组)
题目链接#include#include#include#include#define N 100003using namespace std;int n,m,k,len,sa[N],rank[N],height[N],xx[N],yy[N],*x,*y,p;int b[N],c[N],a[N],st[20][N],l[N];char s[N];int cmp(int原创 2016-12-28 19:34:05 · 389 阅读 · 0 评论 -
bzoj 1717: [Usaco2006 Dec]Milk Patterns 产奶的模式(后缀数组)
1717: [Usaco2006 Dec]Milk Patterns 产奶的模式Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 903 Solved: 495[Submit][Status][Discuss]Description农夫John发现他的奶牛产奶的质量一直在变动。经过细致的调查,他发现:虽然他不能预见明天产奶的质量,原创 2016-05-11 17:45:15 · 935 阅读 · 0 评论 -
bzoj 4278: [ONTAK2015]Tasowanie (后缀数组)
4278: [ONTAK2015]TasowanieTime Limit: 10 Sec Memory Limit: 256 MBSubmit: 161 Solved: 77[Submit][Status][Discuss]Description给定两个数字串A和B,通过将A和B进行二路归并得到一个新的数字串T,请找到字典序最小的T。Input第原创 2016-05-12 16:49:28 · 488 阅读 · 0 评论 -
bzoj 1692: [Usaco2007 Dec]队列变换
1692: [Usaco2007 Dec]队列变换Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 1122 Solved: 465[Submit][Status][Discuss]DescriptionFJ打算带他的N(1 <= N <= 30,000)头奶牛去参加一年一度的“全美农场主大奖赛”。在这场比赛中,每个参赛者都必须让原创 2016-04-19 00:12:32 · 658 阅读 · 0 评论 -
bzoj 2119: 股市的预测 (后缀数组+差分+st表)
2119: 股市的预测Time Limit: 10 Sec Memory Limit: 259 MBSubmit: 283 Solved: 135[Submit][Status][Discuss]Description墨墨的妈妈热爱炒股,她要求墨墨为她编写一个软件,预测某只股票未来的走势。股票折线图是研究股票的必备工具,它通过一张时间与股票的价位的函数图像清晰地展示了股原创 2016-08-16 23:02:42 · 890 阅读 · 0 评论 -
bzoj 4453: cys就是要拿英魂!(后缀数组+二分)
4453: cys就是要拿英魂!Time Limit: 3 Sec Memory Limit: 128 MBSubmit: 77 Solved: 39[Submit][Status][Discuss]Descriptionpps又开始dota视频直播了!一群每天被pps虐的蒟蒻决定学习pps的操作技术,他们把pps在这局放的技能记录了下来,每个技能用一个字符表示原创 2016-08-21 21:01:11 · 764 阅读 · 0 评论 -
UOJ #35 后缀排序(后缀数组)
题目链接题解:后缀数组板子之前学后缀数组只是学了个大概,而且写的是二维的。现在从头理一遍,改成了算法导论上的写法。。#include#include#include#include#define N 100003using namespace std;int rank[N],sa[N],xx[N],yy[N],*x,*y,height[N],b[N],a[N],p,原创 2016-12-28 10:54:47 · 1265 阅读 · 0 评论 -
poj 2774 Long Long Message(后缀数组)
Long Long MessageTime Limit: 4000MS Memory Limit: 131072KTotal Submissions: 25832 Accepted: 10512Case Time Limit: 1000MSDescriptionThe little cat is major原创 2016-04-17 20:03:39 · 822 阅读 · 0 评论 -
bzoj 2251: [2010Beijing Wc]外星联络 (后缀数组)
2251: [2010Beijing Wc]外星联络Time Limit: 30 Sec Memory Limit: 256 MBSubmit: 769 Solved: 459[Submit][Status][Discuss]Description小 P 在看过电影《超时空接触》(Contact)之后被深深的打动,决心致力于寻找外星人的事业。于是,他每天晚上都爬在屋原创 2016-12-29 20:35:01 · 374 阅读 · 0 评论 -
poj 1743 Musical Theme (后缀数组)
Musical ThemeTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 27581 Accepted: 9301DescriptionA musical melody is represented as a sequence of N (1<=N<=20原创 2016-12-28 16:37:15 · 283 阅读 · 0 评论 -
poj 3261 Milk Patterns (后缀数组)
Milk PatternsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 14691 Accepted: 6535Case Time Limit: 2000MSDescriptionFarmer John has noticed that th原创 2016-12-28 17:18:45 · 340 阅读 · 0 评论 -
spoj 694 DISUBSTR - Distinct Substrings (后缀数组)
DISUBSTR - Distinct Substringsno tags Given a string, we need to find the total number of its distinct substrings.InputT- number of test cases. TEach test case consists of one st原创 2016-12-28 17:32:16 · 333 阅读 · 0 评论 -
bzoj 4310: 跳蚤 (后缀数组+二分+ST表)
题目描述传送门题目大意:有一个长度为 n n n 的字符串, 你需要把它分成不超过k 段, 设第 i 段的字典序最大的子串为CiC_i, 现在求 CiC_i中字典序最大的那个最小能是多少。题解看到最小值最大,比较容易想到的思路就是二分。 对于字符串建立后缀数组,字符串中所有的本质不同的子串的个数是∑i=1nn−sa[i]+1−height[i]\sum_{i=1}^n n-sa[i]+1-heig原创 2017-06-25 21:56:37 · 424 阅读 · 0 评论