#include "bits/stdc++.h"
#define ll long long int
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define sz size()
const int N = 2e5 + 1;
using namespace std;
ll ans, mx;
void f(string s){
for(int i = 0; i < (int)s.sz; i++){
int nd = i, nd1 = i;
while(nd >= 0 and nd1 < (int)s.sz and s[nd] == s[nd1]){
ans++;
nd--;
nd1++;
}
}
for(int i = 0; i < (int)s.sz-1; i++){
int nd = i, nd1 = i+1;
while(nd >= 0 and nd1 < (int)s.sz and s[nd] == s[nd1]){
ans++;
nd--;
nd1++;
}
}
}
int main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
//freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
string s1,s2;
cin >> s1;
s2 = s1;
for(int i = 0; i < (int)s1.sz; i++){
for(char j = 'a'; j <= 'z'; j++){
ans = 0;
s2[i] = j;
f(s2);
s2[i] = s1[i];
mx = max(mx,ans);
}
}
cout << mx;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
8 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
452 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1040 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1008 ms |
600 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |