Submission #967423

#TimeUsernameProblemLanguageResultExecution timeMemory
967423Halym2007Palindromes (APIO14_palindrome)C++17
0 / 100
2 ms348 KiB
#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; }

Compilation message (stderr)

palindrome.cpp: In function 'int main()':
palindrome.cpp:12:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  freopen ("polindrome.in", "r", stdin);
      |  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
palindrome.cpp:13:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  freopen ("polindrome.out", "w", stdout);
      |  ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...