luogu2870 [USACO07DEC]最佳牛线,黄金Best Cow Line, Gold

ref

#include 
#include 
#include 
using namespace std;
int nn, n, rnk[60005], tmp[60005], cnt[60005], m=128, p, saa[60005];
char s[15], ss[60005];
void sasort(){
    for(int i=0; i=0; i--)   saa[--cnt[rnk[tmp[i]]]] = tmp[i];
}
void getSuffixArray(){
    for(int i=0; i=j)
                tmp[p++] = saa[i] - j;
        sasort();
        p = 1;
        swap(rnk, tmp);
        rnk[saa[0]] = 0;
        for(int i=1; i>nn;
    for(int i=0; i

转载于:https://www.cnblogs.com/poorpool/p/8921310.html

你可能感兴趣的:(luogu2870 [USACO07DEC]最佳牛线,黄金Best Cow Line, Gold)