Submission #22865

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
228652017-04-30 07:55:12↓우리보다잘하는팀 (#40)New Ocurrences (KRIII5_NO)C++98
0 / 7
1000 ms41120 KiB
#include<cstdio>
#include<algorithm>
using namespace std;
int n, C[101000], ord1[101000], ord2[101000], SA[101000], Rank[101000], LCP[101000], cc;
char p[101000];
struct Tree{
int l, r, s;
}IT[3001000];
int Root[101000];
struct AA{
int a, b;
}w[101000];
void Suffix_Array(){
int i, M = max(n, 200), LL = 1;
for(i=0;i<n;i++){
w[i].a = p[i],w[i].b = p[i+1];
}
while(1){
for(i=0;i<=M;i++)C[i]=0;
for(i=0;i<n;i++)C[w[i].b]++;
for(i=1;i<=M;i++)C[i]+=C[i-1];
for(i=n-1;i>=0;i--)ord1[--C[w[i].b]] = i;
for(i=0;i<=M;i++)C[i]=0;
for(i=0;i<n;i++)C[w[i].a]++;
for(i=1;i<=M;i++)C[i]+=C[i-1];
for(i=n-1;i>=0;i--)ord2[--C[w[ord1[i]].a]] = ord1[i];
int cnt = 0;
for(i=0;i<n;i++){
if(i==0||w[ord2[i]].a!=w[ord2[i-1]].a||w[ord2[i]].b!=w[ord2[i-1]].b)cnt++;
Rank[ord2[i]] = cnt;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

NO.cpp: In function 'int main()':
NO.cpp:100:36: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
             st[++top] = {LCP[i-1],b};
                                    ^
NO.cpp:100:23: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
             st[++top] = {LCP[i-1],b};
                       ^
NO.cpp:107:34: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
         st[++top] = {n - SA[i], i};
                                  ^
NO.cpp:107:19: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
         st[++top] = {n - SA[i], i};
                   ^
NO.cpp:117:34: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
             st[++top] = {LCP[i],b};
                                  ^
NO.cpp:117:23: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
             st[++top] = {LCP[i],b};
                       ^
NO.cpp:124:34: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
         st[++top] = {n - SA[i], i};
                                  ^
NO.cpp:124:19: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
         st[++top] = {n - SA[i], i};
                   ^
NO.cpp:82:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",p);
                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...