Submission #22903

# Submission time Handle Problem Language Result Execution time Memory
22903 2017-04-30T10:54:36 Z imsifile New Ocurrences (KRIII5_NO) C++
2 / 7
63 ms 200452 KB
#include<stdio.h>
#include<string.h>

char st[101010]; int N;
long long dy[5050][5050], sum;

int main(){
	scanf("%s", st+1); N=strlen(st+1);
	for(int i=1; i<=N; i++){
		for(int j=1; j<i; j++){
			if(st[i]==st[j])dy[i][j] = 1+dy[i-1][j-1];
			else dy[i][j]=0;
		}
	}
	for(int i=1; i<=N; i++){
		for(int j=1; j<i; j++)sum += dy[i][j]*2;
		sum += i;
		printf("%lld\n", sum);
	}
	return 0;
}

Compilation message

NO.cpp: In function 'int main()':
NO.cpp:8:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s", st+1); N=strlen(st+1);
                   ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200452 KB Output is correct
2 Correct 0 ms 200452 KB Output is correct
3 Correct 0 ms 200452 KB Output is correct
4 Correct 29 ms 200452 KB Output is correct
5 Correct 46 ms 200452 KB Output is correct
6 Correct 56 ms 200452 KB Output is correct
7 Correct 49 ms 200452 KB Output is correct
8 Correct 0 ms 200452 KB Output is correct
9 Correct 3 ms 200452 KB Output is correct
10 Correct 46 ms 200452 KB Output is correct
11 Correct 46 ms 200452 KB Output is correct
12 Correct 29 ms 200452 KB Output is correct
13 Correct 36 ms 200452 KB Output is correct
14 Correct 63 ms 200452 KB Output is correct
15 Correct 53 ms 200452 KB Output is correct
16 Correct 29 ms 200452 KB Output is correct
17 Correct 43 ms 200452 KB Output is correct
18 Correct 36 ms 200452 KB Output is correct
19 Correct 46 ms 200452 KB Output is correct
20 Correct 33 ms 200452 KB Output is correct
21 Correct 36 ms 200452 KB Output is correct
22 Correct 36 ms 200452 KB Output is correct
23 Correct 29 ms 200452 KB Output is correct
24 Correct 43 ms 200452 KB Output is correct
25 Correct 36 ms 200452 KB Output is correct
26 Correct 29 ms 200452 KB Output is correct
27 Correct 46 ms 200452 KB Output is correct
28 Correct 46 ms 200452 KB Output is correct
29 Correct 33 ms 200452 KB Output is correct
30 Correct 43 ms 200452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 19 ms 200452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -