結果

問題 No.273 回文分解
ユーザー 👑 KazunKazun
提出日時 2020-11-27 04:19:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,368 KB
実行使用メモリ 76,340 KB
最終ジャッジ日時 2023-10-01 03:53:51
合計ジャッジ時間 4,289 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,372 KB
testcase_01 AC 78 ms
75,600 KB
testcase_02 AC 76 ms
71,332 KB
testcase_03 AC 72 ms
71,292 KB
testcase_04 AC 70 ms
71,512 KB
testcase_05 AC 71 ms
71,220 KB
testcase_06 AC 78 ms
75,760 KB
testcase_07 AC 80 ms
75,496 KB
testcase_08 AC 82 ms
76,340 KB
testcase_09 AC 77 ms
75,432 KB
testcase_10 AC 72 ms
71,400 KB
testcase_11 AC 72 ms
71,408 KB
testcase_12 AC 71 ms
71,512 KB
testcase_13 AC 72 ms
71,436 KB
testcase_14 AC 86 ms
76,052 KB
testcase_15 AC 72 ms
71,512 KB
testcase_16 AC 71 ms
71,376 KB
testcase_17 AC 71 ms
71,216 KB
testcase_18 AC 70 ms
71,452 KB
testcase_19 AC 75 ms
71,344 KB
testcase_20 AC 75 ms
71,500 KB
testcase_21 AC 73 ms
71,096 KB
testcase_22 AC 84 ms
76,048 KB
testcase_23 AC 84 ms
76,132 KB
testcase_24 WA -
testcase_25 AC 87 ms
76,160 KB
testcase_26 AC 80 ms
75,704 KB
testcase_27 AC 79 ms
75,216 KB
testcase_28 AC 83 ms
75,532 KB
testcase_29 AC 93 ms
76,336 KB
testcase_30 AC 88 ms
76,324 KB
testcase_31 AC 73 ms
71,248 KB
testcase_32 WA -
testcase_33 AC 72 ms
71,216 KB
testcase_34 AC 72 ms
71,372 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(1,len(S)-1):
    K=max(K,t(S[:i]),t(S[i:]))
print(K)
0