Submission #1024674

#TimeUsernameProblemLanguageResultExecution timeMemory
1024674GangstaPalinilap (COI16_palinilap)C++14
17 / 100
1040 ms600 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...