제출 #134990

#제출 시각아이디문제언어결과실행 시간메모리
134990qrno회문 (APIO14_palindrome)C++14
8 / 100
1080 ms62672 KiB
#include <iostream> #include <string> #include <map> using namespace std; map <string, int> M; inline bool isPalindrome(string s) { for (int i = 0; i < s.size(); i++) { if (s[i] != s[s.size()-i-1]) return false; } return true; } int main() { cin.tie(0); ios_base::sync_with_stdio(false); string a; cin >> a; int ans = 0; for (int i = 0; i < a.size(); i++) { for (int j = i; j < a.size(); j++) { string s = ""; for (int m = i; m <= j; m++) { s += a[m]; } if (isPalindrome(s)) { M[s]++; int m = s.size(); ans = max(ans, m*M[s]); } } } cout << ans << '\n'; return 0; }

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

palindrome.cpp: In function 'bool isPalindrome(std::__cxx11::string)':
palindrome.cpp:9:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < s.size(); i++) {
                     ~~^~~~~~~~~~
palindrome.cpp: In function 'int main()':
palindrome.cpp:26:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < a.size(); i++) {
                     ~~^~~~~~~~~~
palindrome.cpp:27:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         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...