제출 #134980

#제출 시각아이디문제언어결과실행 시간메모리
134980qrno회문 (APIO14_palindrome)C++14
0 / 100
1091 ms101476 KiB
#include <iostream> #include <string> #include <map> using namespace std; map <string, int> M; string a; inline bool isPalindrome(int l, int r) { for (int i = l; i <= r; i++) { if (a[i] != a[r-i]) return false; } return true; } int main() { cin >> a; int ans = 0; for (int i = 0; i < a.size(); i++) { for (int j = i; j < a.size(); j++) { if (isPalindrome(i, j)) { string s; for (int k = i; k <= j; k++) s+=a[i]; M[s]++; ans = max(ans, (j-i+1)*M[s]); } } } cout << ans << endl; return 0; }

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

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