제출 #716774

#제출 시각아이디문제언어결과실행 시간메모리
716774vjudge1회문 (APIO14_palindrome)C++17
23 / 100
1092 ms131072 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const int maxn = 5e5 + 100;
const int mod = (int)1e9+7;
int n;
int main() {
    ios_base::sync_with_stdio(false);
    string s;
    cin >> s;
    n = s.size();
    map<string, int> m;
    for(int i = 0; i < n; i++) {
        string t;
        for(int j = i; j < n; j++) {
            t += s[j];
            int bad = 0;
            for(int k = 0; k < t.size(); k++) {
                if(t[k] != t[t.size() - k - 1]) {
                    bad = 1;
                    break;
                }
            }
            if(not bad) m[t]++;
        }
    }
    int ans = 0;
    for(auto [t, x] : m) {
        ans = max(ans, (int)t.size() * x);
    }
    cout << ans << "\n";
}

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

palindrome.cpp: In function 'int main()':
palindrome.cpp:19:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |             for(int k = 0; k < t.size(); k++) {
      |                            ~~^~~~~~~~~~
#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...