結果

問題 No.273 回文分解
ユーザー 👑 KazunKazun
提出日時 2020-11-27 04:20:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 514 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 77,072 KB
最終ジャッジ日時 2023-10-01 03:53:56
合計ジャッジ時間 4,558 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,256 KB
testcase_01 AC 80 ms
75,736 KB
testcase_02 AC 72 ms
71,096 KB
testcase_03 AC 71 ms
71,132 KB
testcase_04 AC 71 ms
71,420 KB
testcase_05 AC 77 ms
75,440 KB
testcase_06 AC 80 ms
75,580 KB
testcase_07 AC 80 ms
75,668 KB
testcase_08 AC 95 ms
76,156 KB
testcase_09 AC 81 ms
75,624 KB
testcase_10 AC 72 ms
71,200 KB
testcase_11 AC 72 ms
71,216 KB
testcase_12 AC 74 ms
71,192 KB
testcase_13 AC 73 ms
71,184 KB
testcase_14 AC 120 ms
76,828 KB
testcase_15 AC 74 ms
71,244 KB
testcase_16 AC 72 ms
71,352 KB
testcase_17 AC 73 ms
71,340 KB
testcase_18 AC 72 ms
71,356 KB
testcase_19 AC 79 ms
75,608 KB
testcase_20 AC 72 ms
71,260 KB
testcase_21 AC 73 ms
71,472 KB
testcase_22 AC 109 ms
76,792 KB
testcase_23 AC 110 ms
77,020 KB
testcase_24 WA -
testcase_25 AC 111 ms
77,072 KB
testcase_26 AC 98 ms
76,568 KB
testcase_27 AC 103 ms
76,936 KB
testcase_28 AC 106 ms
76,732 KB
testcase_29 AC 119 ms
76,144 KB
testcase_30 AC 135 ms
76,768 KB
testcase_31 AC 73 ms
71,384 KB
testcase_32 WA -
testcase_33 AC 72 ms
71,256 KB
testcase_34 AC 76 ms
71,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def t(X):
    if X=="":
        return 0
    if len(X)==1:
        return 1

    K=-1
    I,J=0,len(X)-2

    while True:
        while True:
            if I>0 and X[I:J+1]==X[J:I-1:-1]:
                break

            if I==0 and X[:J+1]==X[J::-1]:
                break

            J-=1
        K=max(K,J-I+1)
        I=J+1
        J=len(X)-1

        if I==len(X):
            break
    return K

S=input()
K=t(S)

for i in range(len(S)):
    for j in range(i+1,len(S)):
        K=max(K,t(S[i:j]))
print(K)
0