답안 #134940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134940 2019-07-23T13:02:34 Z degelo 회문 (APIO14_palindrome) C++17
23 / 100
189 ms 5900 KB
#include<bits/stdc++.h>
#define maxn 1003
bool marc[maxn][maxn];
using namespace std;
map< string ,int > qtd;
map< string,int >::iterator mit;
int main(){
    string s;
    cin>>s;
    int n=s.size();
    vector<string> subst;
    for(int i=0;i<n;i++){
        string last="";
        last+=s[i];
        for(int i=0;i<subst.size();i++) subst[i]+=last;
        subst.push_back(last);
        for(int j=0;j<=i;j++){
            if(s[j]==s[i]){
                if(i==j||i==j+1){
                    qtd[subst[j]]++;
                    marc[i][j]=true;
                }
                else if(marc[i-1][j+1]){
                    qtd[subst[j]]++;
                    marc[i][j]=true;
                }
            }
        }
    }
    int resp=0;
    for(mit=qtd.begin();mit!=qtd.end();mit++){
        string st=(*mit).first;
        int q=qtd[st];
        int nt=st.size();
        resp=max(resp,q*nt);
    }
    cout<<resp;
}

Compilation message

palindrome.cpp: In function 'int main()':
palindrome.cpp:15:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<subst.size();i++) subst[i]+=last;
                     ~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 504 KB Output is correct
21 Correct 2 ms 504 KB Output is correct
22 Correct 2 ms 380 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 2 ms 504 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
29 Correct 2 ms 504 KB Output is correct
30 Correct 3 ms 376 KB Output is correct
31 Correct 2 ms 504 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 100 ms 2680 KB Output is correct
2 Correct 41 ms 2296 KB Output is correct
3 Correct 189 ms 2684 KB Output is correct
4 Correct 15 ms 2168 KB Output is correct
5 Correct 186 ms 2524 KB Output is correct
6 Correct 186 ms 2612 KB Output is correct
7 Correct 13 ms 2424 KB Output is correct
8 Correct 99 ms 2552 KB Output is correct
9 Correct 12 ms 2168 KB Output is correct
10 Correct 10 ms 2040 KB Output is correct
11 Correct 11 ms 2040 KB Output is correct
12 Correct 12 ms 2296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 111 ms 5192 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 118 ms 5404 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 124 ms 5900 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -