Question:
Evaluate the length of the Child string that appears more than two times but does not overwrite the m string.
Train of Thought Analysis:
The second answer, and then check whether it is satisfied. The method for judging not to overwrite is to use up down to process the boundary.
#include
#include
#include #include
#include
#include
#define maxn 110005using namespace std;char str[maxn];int sa[maxn],t1[maxn],t2[maxn],c[maxn],n;void suffix(int m){ int *x=t1,*y=t2; for(int i=0; i
=0; i--)sa[--c[x[i]]]=i; for(int k=1; k<=n; k<<=1) { int p=0; for(int i=n-k; i
=k)y[p++]=sa[i]-k; for(int i=0; i
=0; i--)sa[--c[x[y[i]]]]=y[i]; swap(x,y); p=1; x[sa[0]]=0; for(int i=1; i
=n)break; m=p; }}int rank[maxn],height[maxn];void getheight(){ int k=0; for(int i=0; i
>1; if(check(mid,m)) ans=mid,l=mid+1; else r=mid-1; } printf("%d\n",ans); } return 0;}