Skip to content

Commit 434c013

Browse files
committed
Fixed some bugs
1 parent 0e23450 commit 434c013

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/untested-codes/suffix_array.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
using namespace std;
1414

1515
//----------------------
16-
const int INF = 1000000000+5;
17-
1816
// inputs
1917
string s;
2018
int n;
2119

20+
const int MAX = 1000005;
21+
const int INF = 1000000000+5;
22+
2223
int lgn=0;
23-
int sa[25][1000005];
24-
int rankSuf[1000005];
24+
int sa[25][MAX];
25+
int rankSuf[MAX];
2526
void constructSA() {
2627
map<int,int> rank;
2728
for (int i=0; i<n; i++) rank[s[i]]=0;
@@ -56,7 +57,7 @@ int getLCP(int p, int q) {
5657
return l;
5758
}
5859

59-
int lcp[25][1000005];
60+
int lcp[25][MAX];
6061
void processlcp() {
6162
int N=n-1;
6263
for (int i=0; i<N; i++) lcp[0][i]=getLCP(rankSuf[i], rankSuf[i+1]);
@@ -69,10 +70,10 @@ void processlcp() {
6970
}
7071
}
7172

72-
int frameSize[1000005];
73+
int frameSize[MAX];
7374
int processFrameSize(){
74-
for(int i=0, pow2=1; pow2<1000005; pow2*=2, i++) frameSize[pow2]=i;
75-
for(int i=3;i<1000005;i++) {
75+
for(int i=0, pow2=1; pow2<MAX; pow2*=2, i++) frameSize[pow2]=i;
76+
for(int i=3;i<MAX;i++) {
7677
if(frameSize[i]==0) {
7778
frameSize[i]=frameSize[i-1];
7879
}

0 commit comments

Comments
 (0)