# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
394671 | 2021-04-27T07:19:41 Z | Anand | Palindromes (APIO14_palindrome) | C++14 | 1000 ms | 8300 KB |
#include <bits/stdc++.h> using namespace std; void expand(string str, int low, int high, auto& set) { while (low >= 0 && high < str.length() && str[low] == str[high]) { set.insert(str.substr(low, high - low + 1)); low--, high++; } } int main() { string str; cin >> str; unordered_set<string> set; vector<int> res; for (int i = 0; i < str.length(); i++) { expand(str, i, i, set); expand(str, i, i + 1, set); } for(auto l = set.begin(); l != set.end(); l++) { string p = *l; int small = p.size(); int count = 0; for (int i = 0; i <= str.size() - small; i++) { int j; for (j = 0; j < small; j++) if (str[i+j] != p[j]) break; if (j == small) { count++; j = 0; } } //cout << p << ":" << count << endl; res.push_back(count*small); } sort(res.begin() , res.end()); int sz = res.size(); cout << res[sz-1]; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 292 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 300 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 300 KB | Output is correct |
14 | Correct | 1 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 292 KB | Output is correct |
23 | Correct | 1 ms | 204 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 1 ms | 204 KB | Output is correct |
26 | Correct | 1 ms | 204 KB | Output is correct |
27 | Correct | 1 ms | 204 KB | Output is correct |
28 | Correct | 1 ms | 204 KB | Output is correct |
29 | Correct | 1 ms | 204 KB | Output is correct |
30 | Correct | 1 ms | 204 KB | Output is correct |
31 | Correct | 1 ms | 204 KB | Output is correct |
32 | Correct | 0 ms | 292 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 147 ms | 884 KB | Output is correct |
2 | Correct | 58 ms | 540 KB | Output is correct |
3 | Correct | 305 ms | 888 KB | Output is correct |
4 | Correct | 8 ms | 452 KB | Output is correct |
5 | Correct | 291 ms | 1012 KB | Output is correct |
6 | Correct | 307 ms | 884 KB | Output is correct |
7 | Correct | 5 ms | 716 KB | Output is correct |
8 | Correct | 149 ms | 880 KB | Output is correct |
9 | Correct | 5 ms | 332 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 7 ms | 588 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1073 ms | 7904 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1092 ms | 8300 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1098 ms | 8192 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |