# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
22438 | PurpleNoon backward compatibility (#40) | Joyful KMP (KRIII5_JK) | C++98 | 103 ms | 221820 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<stdio.h>
#include<string.h>
char b[2000000];
int fa[2000000];
int bb[2000000][27],ch[100];
int main(){
int n,l,i,s,e;
unsigned long long int cnt=0,count=0;
scanf("%s",b);
l=strlen(b);
s = -1; e = 0; fa[0] = -1;
while (e < l) {
for(i=1;i<=26;i++) ch[i]=0;
cnt=0;
while (s > -1 && b[s] != b[e]) {
ch[b[s]-96]=1; s = fa[s];
}
for(i=1;i<=26;i++) {if(ch[i]==1) cnt++;}
s++; e++;
fa[e] = s;
if(fa[e]==0) {
count++;
bb[count][0]=26-cnt;
for(i=1;i<=26;i++) bb[count][i]=ch[i];
}
}
cnt=1;
for(i=1;i<=count;i++){
cnt*=bb[i][0];
cnt%=1000000007;
}
printf("%d\n",cnt);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |