# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
22840 | 크리콘 B번 문제는 그리디로 풀려요 (#40) | New Ocurrences (KRIII5_NO) | C++98 | 16 ms | 100832 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<stdio.h>
#include<string.h>
char st[101010]; int N;
int dy[5050][5050]; long long sum;
int main(){
gets(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];
}
}
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |