设为首页 加入收藏

TOP

POJ 2774 Long Long Message (后缀数组模板)
2014-11-23 19:22:27 来源: 作者: 【 】 浏览:3
Tags:POJ 2774 Long Message 后缀 模板

借用罗大神的模板,开始搞后缀数组

#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;
}


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇poj 1247 The Perfect Stall 裸的.. 下一篇HDU 4670 Cube number on a tree

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·求navicat for mysql (2025-12-26 13:21:33)
·有哪位大哥推荐一下m (2025-12-26 13:21:30)
·MySQL下载与安装教程 (2025-12-26 13:21:26)
·Linux_百度百科 (2025-12-26 12:51:52)
·Shell 流程控制 | 菜 (2025-12-26 12:51:49)