답안 #897621

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
897621 2024-01-03T13:43:33 Z AndrijaM 회문 (APIO14_palindrome) C++14
8 / 100
1000 ms 2408 KB
#include <bits/stdc++.h>

using namespace std;

const long long maxn=1e4+10;
const long long mod=1e9+7;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    string s;
    cin>>s;
    int n=s.size();
    map<deque<char>,int>m;
    for(int i=0;i<n;i++)
    {
        deque<char>Q;
        int l=i;
        int r=i;
        Q.push_front(s[i]);
        m[Q]++;
        while(l-1>=0 && r+1<n)
        {
            if(s[l-1]==s[r+1])
            {
                l--;
                r++;
                Q.push_front(s[l]);
                Q.push_back(s[r]);
                m[Q]++;
            }
            else
            {
                break;
            }
        }
    }
    for(int i=0;i<n-1;i++)
    {
        deque<char>Q;
        int l=i;
        int r=i+1;
        if(s[l]!=s[r])continue;
        Q.push_front(s[l]);
        Q.push_back(s[r]);
        m[Q]++;
        while(l-1>=0 && r+1<n)
        {
            if(s[l-1]==s[r+1])
            {
                l--;
                r++;
                Q.push_front(s[l]);
                Q.push_back(s[r]);
                m[Q]++;
            }
            else
            {
                break;
            }
        }
    }
    long long ans=0LL;
    for(auto ax:m)
    {
        long long num=ax.first.size()*ax.second;
        ans=max(num,ans);
    }
    cout<<ans<<endl;
    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 2 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1036 ms 1716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1027 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1081 ms 2408 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1056 ms 2400 KB Time limit exceeded
2 Halted 0 ms 0 KB -