2011年3月13日

poj 3261

摘要: 后缀数组,height的二分。#include<iostream>#include<fstream>using namespace std;#define N 20011int sa[N],sa1[N],rank[N],rank1[N],c[N],h[N];int m[N];int n,pow,count;int cmp(const void *a,const void *b){ int x=*(int*)a; int y=*(int*)b; if(rank[x]!=rank[y]) return(1); else if(rank[x+pow]!=rank[y+pow] 阅读全文

posted @ 2011-03-13 15:12 宇宙吾心 阅读(571) 评论(0) 推荐(0)

poj 3080

摘要: 后缀数组,二分求多串子串,height数组山的结构。#include<iostream>#include<fstream>using namespace std;#define N 620int sa[N],sa1[N],rank[N],rank1[N],c[N],h[N];char m[N];int n,pow,count;int cmp(const void *a,const void *b){ int x=*(int*)a; int y=*(int*)b; if(rank[x]!=rank[y]) return(1); else if(rank[x+pow]!=r 阅读全文

posted @ 2011-03-13 14:06 宇宙吾心 阅读(673) 评论(0) 推荐(0)

poj 3576

摘要: hash判断子树是否相同,并且自身的终结性要相同。代码:#include<iostream>#include<fstream>using namespace std;#define prim 99983struct { int end; int p[30];}tree[150001];int n,m;char c[30];int state;void build(char c[]){ int i,j,k; i=1; for(j=0;j<strlen(c);j++) { k=c[j]-'a'; if(tree[i].p[k]==0) tree[i]. 阅读全文

posted @ 2011-03-13 12:22 宇宙吾心 阅读(402) 评论(0) 推荐(0)

导航