# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48004 | 2018-05-09T11:11:05 Z | E869120 | Palindromes (APIO14_palindrome) | C++14 | 1000 ms | 68344 KB |
#include <iostream> #include <string> #include <vector> #include <map> #include <algorithm> using namespace std; bool pal(string S) { string T = S; reverse(T.begin(), T.end()); if (S == T) return true; return false; } string S; vector<long long>A; map<long long, int>M; int maxn = 0; long long rem[100009], power[100009]; void init() { power[0] = 1; for (int i = 1; i < 100009; i++) power[i] = power[i - 1] * 31LL; for (int i = 1; i <= S.size(); i++) { rem[i] = rem[i - 1] * 31LL; rem[i] += (S[i - 1] - 'a' + 1); } } long long hash_value(long long l, long long r) { return rem[r] - rem[l] * power[r - l]; } int main() { cin >> S; init(); for (int i = 0; i < S.size(); i++) { int L = i, R = i; while (L >= 0 && R < S.size()) { if (S[L] != S[R]) break; long long J = hash_value(L, R + 1); M[J] += (R - L + 1); A.push_back(J); L--; R++; } L = i; R = i + 1; while (L >= 0 && R < S.size()) { if (S[L] != S[R]) break; long long J = hash_value(L, R + 1); M[J] += (R - L + 1); A.push_back(J); L--; R++; } } for (int i = 0; i < A.size(); i++) maxn = max(maxn, M[A[i]]); cout << maxn << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1016 KB | Output is correct |
2 | Correct | 2 ms | 1124 KB | Output is correct |
3 | Correct | 2 ms | 1328 KB | Output is correct |
4 | Correct | 2 ms | 1380 KB | Output is correct |
5 | Correct | 2 ms | 1380 KB | Output is correct |
6 | Correct | 2 ms | 1384 KB | Output is correct |
7 | Correct | 2 ms | 1384 KB | Output is correct |
8 | Correct | 2 ms | 1384 KB | Output is correct |
9 | Correct | 2 ms | 1384 KB | Output is correct |
10 | Correct | 2 ms | 1384 KB | Output is correct |
11 | Correct | 2 ms | 1384 KB | Output is correct |
12 | Correct | 2 ms | 1384 KB | Output is correct |
13 | Correct | 3 ms | 1384 KB | Output is correct |
14 | Correct | 3 ms | 1384 KB | Output is correct |
15 | Correct | 2 ms | 1384 KB | Output is correct |
16 | Correct | 2 ms | 1388 KB | Output is correct |
17 | Correct | 3 ms | 1392 KB | Output is correct |
18 | Correct | 2 ms | 1392 KB | Output is correct |
19 | Correct | 2 ms | 1392 KB | Output is correct |
20 | Correct | 3 ms | 1392 KB | Output is correct |
21 | Correct | 2 ms | 1392 KB | Output is correct |
22 | Correct | 2 ms | 1392 KB | Output is correct |
23 | Correct | 3 ms | 1516 KB | Output is correct |
24 | Correct | 2 ms | 1516 KB | Output is correct |
25 | Correct | 3 ms | 1516 KB | Output is correct |
26 | Correct | 2 ms | 1516 KB | Output is correct |
27 | Correct | 2 ms | 1516 KB | Output is correct |
28 | Correct | 2 ms | 1516 KB | Output is correct |
29 | Correct | 3 ms | 1516 KB | Output is correct |
30 | Correct | 2 ms | 1516 KB | Output is correct |
31 | Correct | 2 ms | 1516 KB | Output is correct |
32 | Correct | 2 ms | 1516 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 3568 KB | Output is correct |
2 | Correct | 15 ms | 3568 KB | Output is correct |
3 | Correct | 69 ms | 5608 KB | Output is correct |
4 | Correct | 5 ms | 5608 KB | Output is correct |
5 | Correct | 68 ms | 5608 KB | Output is correct |
6 | Correct | 68 ms | 5608 KB | Output is correct |
7 | Correct | 3 ms | 5608 KB | Output is correct |
8 | Correct | 36 ms | 5608 KB | Output is correct |
9 | Correct | 4 ms | 5608 KB | Output is correct |
10 | Correct | 3 ms | 5608 KB | Output is correct |
11 | Correct | 2 ms | 5608 KB | Output is correct |
12 | Incorrect | 3 ms | 5608 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1080 ms | 67492 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1066 ms | 68344 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 16 ms | 68344 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |