Submission #104482

#TimeUsernameProblemLanguageResultExecution timeMemory
104482E869120Palindromes (APIO14_palindrome)C++14
23 / 100
1079 ms3108 KiB
#include <iostream> #include <string> #include <map> #include <algorithm> using namespace std; map<long long, long long>Map; long long maxn = 0; string S; bool ispalindrome(string V) { for (int i = 0; i < V.size(); i++) { if (V[i] != V[V.size() - 1 - i]) return false; } return true; } int main() { cin >> S; for (int i = 0; i < S.size(); i++) { long long r = 0; for (int j = i; j < S.size(); j++) { r *= 311; r += (long long)(S[j] - 'a' + 1); if (ispalindrome(S.substr(i, j - i + 1)) == false) continue; Map[r] += 1LL * (j - i + 1); maxn = max(maxn, Map[r]); } } cout << maxn << endl; return 0; }

Compilation message (stderr)

palindrome.cpp: In function 'bool ispalindrome(std::__cxx11::string)':
palindrome.cpp:11:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < V.size(); i++) {
                  ~~^~~~~~~~~~
palindrome.cpp: In function 'int main()':
palindrome.cpp:19:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < S.size(); i++) {
                  ~~^~~~~~~~~~
palindrome.cpp:21:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = i; j < S.size(); j++) {
                   ~~^~~~~~~~~~
#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...