Submission #22438

# Submission time Handle Problem Language Result Execution time Memory
22438 2017-04-30T04:40:34 Z PurpleNoon backward compatibility(#974, ainch, semteo) Joyful KMP (KRIII5_JK) C++
2 / 7
103 ms 221820 KB
#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;
}

Compilation message

JK.cpp: In function 'int main()':
JK.cpp:28:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=1;i<=count;i++){
           ^
JK.cpp:32:19: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long unsigned int' [-Wformat=]
  printf("%d\n",cnt);
                   ^
JK.cpp:7:6: warning: unused variable 'n' [-Wunused-variable]
  int n,l,i,s,e;
      ^
JK.cpp:9:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",b);
               ^
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 221820 KB Output is partially correct
2 Partially correct 0 ms 221820 KB Output is partially correct
3 Partially correct 0 ms 221820 KB Output is partially correct
4 Partially correct 0 ms 221820 KB Output is partially correct
5 Partially correct 79 ms 221820 KB Output is partially correct
6 Partially correct 79 ms 221820 KB Output is partially correct
7 Partially correct 103 ms 221820 KB Output is partially correct
8 Partially correct 73 ms 221820 KB Output is partially correct
9 Partially correct 73 ms 221820 KB Output is partially correct
10 Partially correct 0 ms 221820 KB Output is partially correct
11 Partially correct 0 ms 221820 KB Output is partially correct
12 Partially correct 0 ms 221820 KB Output is partially correct
13 Partially correct 0 ms 221820 KB Output is partially correct
14 Partially correct 0 ms 221820 KB Output is partially correct
15 Partially correct 3 ms 221820 KB Output is partially correct
16 Partially correct 3 ms 221820 KB Output is partially correct
17 Partially correct 39 ms 221820 KB Output is partially correct
18 Partially correct 53 ms 221820 KB Output is partially correct
19 Partially correct 69 ms 221820 KB Output is partially correct
20 Partially correct 63 ms 221820 KB Output is partially correct
21 Partially correct 59 ms 221820 KB Output is partially correct
22 Partially correct 59 ms 221820 KB Output is partially correct
23 Partially correct 39 ms 221820 KB Output is partially correct
24 Partially correct 33 ms 221820 KB Output is partially correct
25 Partially correct 33 ms 221820 KB Output is partially correct
26 Partially correct 43 ms 221820 KB Output is partially correct
27 Partially correct 43 ms 221820 KB Output is partially correct
28 Partially correct 36 ms 221820 KB Output is partially correct
29 Partially correct 43 ms 221820 KB Output is partially correct
30 Partially correct 26 ms 221820 KB Output is partially correct
31 Partially correct 33 ms 221820 KB Output is partially correct
32 Partially correct 36 ms 221820 KB Output is partially correct
33 Partially correct 36 ms 221820 KB Output is partially correct
34 Partially correct 39 ms 221820 KB Output is partially correct
35 Partially correct 36 ms 221820 KB Output is partially correct
36 Partially correct 36 ms 221820 KB Output is partially correct
37 Partially correct 33 ms 221820 KB Output is partially correct
38 Partially correct 36 ms 221820 KB Output is partially correct
39 Partially correct 36 ms 221820 KB Output is partially correct
40 Partially correct 53 ms 221820 KB Output is partially correct
41 Partially correct 36 ms 221820 KB Output is partially correct
42 Partially correct 33 ms 221820 KB Output is partially correct
43 Partially correct 39 ms 221820 KB Output is partially correct
44 Partially correct 36 ms 221820 KB Output is partially correct
45 Partially correct 33 ms 221820 KB Output is partially correct
46 Partially correct 29 ms 221820 KB Output is partially correct
47 Partially correct 33 ms 221820 KB Output is partially correct
48 Partially correct 33 ms 221820 KB Output is partially correct
49 Partially correct 33 ms 221820 KB Output is partially correct
50 Partially correct 36 ms 221820 KB Output is partially correct