借用罗大神的模板,开始搞后缀数组
#include
#include
#include
#include
using namespace std;
#define N 222222
/****后缀数组模版****/
#define F(x)((x)/3+((x)%3==1 0:tb)) //F(x)求出原字符串的suffix(x)在新的字符串中的起始位置
#define G(x)((x)=0; i--)
b[--WS[wv[i]]]=a[i];
return;
}
//注意点:为了方便下面的递归处理,r数组和sa数组的大小都要是3*n
void dc3(int *r,int *sa,int n,int m) { //rn数组保存的是递归处理的新字符串,san数组是新字符串的sa
int i , j , *rn = r+n , *san = sa+n , ta = 0 ,tb = (n+1)/3 , tbc = 0 , p;
r[n] = r[n+1] = 0;
for(i=0; i sa[i-1]) || (len1 < sa[i-1] && len1 > sa[i])))
ans = height[i];
}
cout << ans << endl;
return 0;
}
#include
#include
#include
#include
using namespace std;
#define N 222222
/****后缀数组模版****/
#define F(x)((x)/3+((x)%3==1 0:tb)) //F(x)求出原字符串的suffix(x)在新的字符串中的起始位置
#define G(x)((x)=0; i--)
b[--WS[wv[i]]]=a[i];
return;
}
//注意点:为了方便下面的递归处理,r数组和sa数组的大小都要是3*n
void dc3(int *r,int *sa,int n,int m) { //rn数组保存的是递归处理的新字符串,san数组是新字符串的sa
int i , j , *rn = r+n , *san = sa+n , ta = 0 ,tb = (n+1)/3 , tbc = 0 , p;
r[n] = r[n+1] = 0;
for(i=0; i sa[i-1]) || (len1 < sa[i-1] && len1 > sa[i])))
ans = height[i];
}
cout << ans << endl;
return 0;
}