結果

問題 No.2204 Palindrome Splitting (No Rearrangement ver.)
ユーザー 👑 KazunKazun
提出日時 2023-02-04 01:24:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,083 ms / 2,000 ms
コード長 585 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 273,496 KB
最終ジャッジ日時 2023-09-15 21:53:58
合計ジャッジ時間 27,109 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,248 KB
testcase_01 AC 75 ms
71,204 KB
testcase_02 AC 74 ms
71,360 KB
testcase_03 AC 560 ms
190,300 KB
testcase_04 AC 186 ms
103,176 KB
testcase_05 AC 152 ms
91,240 KB
testcase_06 AC 982 ms
273,104 KB
testcase_07 AC 730 ms
251,968 KB
testcase_08 AC 685 ms
235,548 KB
testcase_09 AC 804 ms
243,668 KB
testcase_10 AC 1,012 ms
273,496 KB
testcase_11 AC 680 ms
235,620 KB
testcase_12 AC 971 ms
271,236 KB
testcase_13 AC 976 ms
273,112 KB
testcase_14 AC 1,009 ms
273,140 KB
testcase_15 AC 858 ms
256,892 KB
testcase_16 AC 349 ms
151,440 KB
testcase_17 AC 487 ms
175,088 KB
testcase_18 AC 976 ms
272,964 KB
testcase_19 AC 1,015 ms
273,336 KB
testcase_20 AC 997 ms
273,188 KB
testcase_21 AC 985 ms
273,132 KB
testcase_22 AC 1,083 ms
273,208 KB
testcase_23 AC 989 ms
273,232 KB
testcase_24 AC 1,083 ms
273,336 KB
testcase_25 AC 1,020 ms
273,184 KB
testcase_26 AC 975 ms
273,188 KB
testcase_27 AC 606 ms
203,504 KB
testcase_28 AC 1,013 ms
273,312 KB
testcase_29 AC 981 ms
273,092 KB
testcase_30 AC 73 ms
71,520 KB
testcase_31 AC 73 ms
71,080 KB
testcase_32 AC 741 ms
224,448 KB
testcase_33 AC 988 ms
273,348 KB
testcase_34 AC 72 ms
71,304 KB
testcase_35 AC 743 ms
224,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    S="*"+input(); N=len(S)-1

    E=[[None for r in range(N+2)] for l in range(N+2)]
    for l in range(N+1,-1,-1):
        El=E[l]
        Ell=E[l+1] if l<N+1 else None
        for r in range(l,N+2):
            if r-l<=1:
                El[r]=True
            else:
                El[r]=(S[l]==S[r-1]) and Ell[r-1]

    DP=[0]*(N+1); DP[0]=N+1
    for i in range(1,N+1):
        for j in range(1,i+1):
            if E[j][i+1]:
                DP[i]=max(DP[i], min(DP[j-1], i-j+1))
    return DP[N]

#==================================================
print(solve())
0