#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sz size()
#define ff first
#define ss second
const int N = 1e5 + 5;
map <string, int> m;
string s;
int n, jog;
int main () {
// freopen ("polindrome.in", "r", stdin);
// freopen ("polindrome.out", "w", stdout);
// freopen ("input.txt", "r", stdin);
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> s;
int n = (int)s.sz;
string t;
for (int i = 0; i < n; ++i) {
t = "";
for (int j = i; j < n; ++j) {
t += s[j];
bool tr = 0;
for (int k = 0; k < (int)t.sz / 2; ++k) {
if (t[k] != t[(int)t.sz - k - 1]) {
tr = 1;
break;
}
}
if (!tr) {
m[t]++;
}
}
}
for (auto i : m) {
int x = (int)i.ff.sz;
int y = m[i.ff];
jog = max (jog, x * y);
// if (x == 14) {
// cout << x << " " << m[i.ff] << " " << i.ff << " " << m[i.ff] << " " << (int)i.ff.sz<< "\n";
// }
}
cout << jog;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
456 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
456 KB |
Output is correct |
14 |
Correct |
1 ms |
504 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
456 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
456 KB |
Output is correct |
25 |
Correct |
1 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
1 ms |
600 KB |
Output is correct |
31 |
Correct |
0 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
856 KB |
Output is correct |
2 |
Correct |
18 ms |
600 KB |
Output is correct |
3 |
Correct |
108 ms |
1016 KB |
Output is correct |
4 |
Correct |
4 ms |
600 KB |
Output is correct |
5 |
Correct |
109 ms |
1012 KB |
Output is correct |
6 |
Correct |
127 ms |
856 KB |
Output is correct |
7 |
Correct |
4 ms |
856 KB |
Output is correct |
8 |
Correct |
56 ms |
1028 KB |
Output is correct |
9 |
Correct |
3 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
2 ms |
348 KB |
Output is correct |
12 |
Correct |
5 ms |
860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1037 ms |
50160 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
150 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
150 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |