답안 #111243

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
111243 2019-05-14T12:54:56 Z _demon_ 회문 (APIO14_palindrome) C++14
23 / 100
1000 ms 132096 KB
#include <bits/stdc++.h>
using namespace std;
string s;
vector<string>v;
set<string>st;
map<string,int>mp;
bool check(string x){
    string xx=x;
    reverse(xx.begin(),xx.end());
    if(x==xx) return 1;
    return 0;
}
void edit(){
    for(set<string>::iterator i=st.begin();i!=st.end();i++){
        v.push_back(*i);
    }
}
int main(){
    cin>>s;
    for(int i=0;i<s.size();i++){
        string x="";
        for(int j=i;j<s.size();j++){
            x+=s[j];
            if(check(x)){
                st.insert(x);
                mp[x]++;
            }
        }
    }
    edit();
    long long mx=0;
    for(int i=0;i<v.size();i++){
        mx=max(mx,(long long)v[i].size()*mp[v[i]]);
    }
    cout<<mx<<endl;
}

Compilation message

palindrome.cpp: In function 'int main()':
palindrome.cpp:20:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++){
                 ~^~~~~~~~~
palindrome.cpp:22:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=i;j<s.size();j++){
                     ~^~~~~~~~~
palindrome.cpp:32:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v.size();i++){
                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 300 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 128 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 256 KB Output is correct
15 Correct 6 ms 256 KB Output is correct
16 Correct 2 ms 512 KB Output is correct
17 Correct 3 ms 256 KB Output is correct
18 Correct 3 ms 384 KB Output is correct
19 Correct 5 ms 512 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 3 ms 384 KB Output is correct
23 Correct 4 ms 384 KB Output is correct
24 Correct 3 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 3 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 4 ms 384 KB Output is correct
31 Correct 4 ms 256 KB Output is correct
32 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 354 ms 2040 KB Output is correct
2 Correct 288 ms 1176 KB Output is correct
3 Correct 643 ms 2036 KB Output is correct
4 Correct 173 ms 632 KB Output is correct
5 Correct 533 ms 2028 KB Output is correct
6 Correct 610 ms 2032 KB Output is correct
7 Correct 194 ms 1656 KB Output is correct
8 Correct 563 ms 2036 KB Output is correct
9 Correct 200 ms 760 KB Output is correct
10 Correct 202 ms 604 KB Output is correct
11 Correct 163 ms 376 KB Output is correct
12 Correct 187 ms 1368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1070 ms 100088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 353 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 363 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -