# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
24775 | 2017-06-13T13:14:13 Z | Extazy | Palindromes (APIO14_palindrome) | C++14 | 1000 ms | 2020 KB |
/* example test starts 2 abacaba www example test ends */ #include <bits/stdc++.h> using namespace std; const int N = 16; int n; char a[N]; int ans; bool is_palindrome(int l, int r) { while(l<r) if(a[l++]!=a[r--]) return false; return true; } int count_occ(int l, int r) { int ans=0,cnt,i,j; for(i=1;i+r-l<=n;i++) { cnt=0; for(j=i;j<=i+r-l;j++) if(a[j]==a[l+j-i]) ++cnt; if(cnt==r-l+1) ++ans; } return ans; } int main() { int tests,current_case; int i,j; tests=1; for(current_case=1;current_case<=tests;current_case++) { scanf("%s", a+1); n=strlen(a+1); ans=0; for(i=1;i<=n;i++) for(j=i;j<=n;j++) if(is_palindrome(i,j)) { ans=max(ans,(j-i+1)*count_occ(i,j)); } printf("%d\n", ans); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2020 KB | Output is correct |
2 | Correct | 0 ms | 2020 KB | Output is correct |
3 | Correct | 0 ms | 2020 KB | Output is correct |
4 | Correct | 0 ms | 2020 KB | Output is correct |
5 | Correct | 0 ms | 2020 KB | Output is correct |
6 | Correct | 0 ms | 2020 KB | Output is correct |
7 | Correct | 0 ms | 2020 KB | Output is correct |
8 | Correct | 0 ms | 2020 KB | Output is correct |
9 | Correct | 0 ms | 2020 KB | Output is correct |
10 | Incorrect | 0 ms | 2020 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 2020 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1000 ms | 2020 KB | Execution timed out |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 2020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 2020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |