제출 #976176

#제출 시각아이디문제언어결과실행 시간메모리
976176JahonaliX회문 (APIO14_palindrome)C++17
8 / 100
1069 ms131072 KiB
#include <bits/stdc++.h> using namespace std; #define int long long bool is_palindrome(string a) { for (int i = 0; i < a.size(); ++i) { if (a[i] != a[a.size() - i - 1]) return false; } return true; } signed main() { string a; cin >> a; map<string, int> mp; int mx = 0; for (int i = 0; i < a.size(); ++i) { string b = ""; for (int j = i; j < a.size(); ++j) { b += a[j]; if (mp[b]) mp[b]++; else if (is_palindrome(b)) mp[b]++; } } for (auto &[x, y] : mp) { mx = max(y * (int) x.size(), mx); } cout << mx; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

palindrome.cpp: In function 'bool is_palindrome(std::string)':
palindrome.cpp:8:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i = 0; i < a.size(); ++i) {
      |                     ~~^~~~~~~~~~
palindrome.cpp: In function 'int main()':
palindrome.cpp:19:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for (int i = 0; i < a.size(); ++i) {
      |                     ~~^~~~~~~~~~
palindrome.cpp:21:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for (int j = i; j < a.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...