結果

問題 No.273 回文分解
コンテスト
ユーザー nasadigital
提出日時 2015-08-29 02:09:07
言語 C++11
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 478 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,433 ms
コンパイル使用メモリ 179,824 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2026-05-29 12:16:09
合計ジャッジ時間 5,656 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

string s;

bool chk(int st,int ed){
    ed--;
    while(st<ed){
        if(s[st]!=s[ed])
            return false;
        st++;
        ed--;
    }
    return true;
}

int rek(int st,bool a){
    int r=1;
    for(int ctr1=st+1;ctr1<=s.length()-a;ctr1++){
        if(chk(st,ctr1)){
            r=max(ctr1-st,max(r,rek(ctr1,false)));
        }
    }
    return r;
}

int main()
{
    cin>>s;
    cout<<rek(0,true);
    return 0;
}
0