求重复k次的最长重复子串,解法见罗穗骞大神的后缀数组论文 ; var x,y,rank,sa,h,s,num,c:..maxn] of longint; n,time:longint; function max(x,y:longint):longint; begin if x>y then exit(x) else exit(y); end; function min(x,y:longint):longint; begin if x<y then exit(x) else exit(y); e…
就是后缀自动机的板子嘛..构造完自动机之后拓扑一下,记录size,对于size大于k的点和ans取max #include<iostream> #include<cstdio> #include<cstring> #include<map> using namespace std; const int N=100005; int n,m,a[N],cur=1,cnt=1; int read() { int r=0,f=1; char p=getchar();…
题目链接 思路 先求出后缀数组,并且求出LCP.二分一下长度len.check的时候就是看有没有连续的k个后缀的LCP大于len.也就是判断是不是有连续的k-1个height大于len. 代码 #include<cstdio> #include<iostream> using namespace std; typedef long long ll; const int N = 20000+10; ll read() { ll x = 0,f = 1;char c = getchar…
Farmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can't predict the quality of milk from one day to the next, there are some regular patterns in the dai…