foj 2075 Substring

题目链接:http://acm.fzu.edu.cn/problem.php?pid=2075

题目大意:求恰好出现n次的字典序最小的串。

题目思路:后缀数组加单调栈,n为1的时候要特判,不过数据有点水,不判都能过。

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define inf 0x3f3f3f3f
#define M 100010
int max(int a,int b)
{
	return a>b?a:b;
}
int min(int a,int b)
{
	return a=0;i--) sa[--ts[x[i]]]=i;

    for(j=1,p=1;p=j) y[p++]=sa[i]-j;
        for(i=0;i=0;i--) sa[--ts[tv[i]]]=y[i];
        swap(x,y);
        x[sa[0]]=0;
        p=1;
        for(i=1;i=height[i])
        {
            tmp.h+=q[tail-1].h;
            tmp.st=q[tail-1].st;
            tmp.w=q[tail-1].w;
            if(tmp.h==k-1&&tmp.w>height[i])
            {
                st=sa[tmp.st];
                if(top


 

你可能感兴趣的:(数据结构)