Submission #249068

#TimeUsernameProblemLanguageResultExecution timeMemory
249068kingfran1907Palinilap (COI16_palinilap)C++14
17 / 100
1094 ms512 KiB
#include <bits/stdc++.h> using namespace std; typedef long long llint; const int maxn = 2010; int n; char niz[maxn]; int main() { scanf("%s", niz); n = strlen(niz); int sol = 0; for (int i = 0; i < n; i++) { char cp = niz[i]; for (int j = 'a'; j <= 'z'; j++) { niz[i] = j; int tren = 0; for (int k = 0; k < n; k++) { int l = k, r = k; while (true) { //printf("tried: %d %d\n", l, r); if (l < 0 || r >= n) break; if (niz[l] == niz[r]) { //printf("debug: %d %d\n", l, r); tren++; l--, r++; } else break; } } for (int k = 1; k < n; k++) { int l = k - 1, r = k; while (true) { //printf("tried: %d %d\n", l, r); if (l < 0 || r >= n) break; if (niz[l] == niz[r]) { //printf("debug: %d %d\n", l, r); tren++; l--, r++; } else break; } } sol = max(sol, tren); } niz[i] = cp; } printf("%d", sol); return 0; }

Compilation message (stderr)

palinilap.cpp: In function 'int main()':
palinilap.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s", niz); n = strlen(niz);
     ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...