結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,456 KB
testcase_01 AC 75 ms
71,256 KB
testcase_02 AC 74 ms
71,152 KB
testcase_03 AC 562 ms
190,416 KB
testcase_04 AC 187 ms
103,468 KB
testcase_05 AC 153 ms
91,652 KB
testcase_06 AC 993 ms
273,360 KB
testcase_07 AC 742 ms
252,076 KB
testcase_08 AC 695 ms
235,820 KB
testcase_09 AC 819 ms
243,920 KB
testcase_10 AC 1,025 ms
273,120 KB
testcase_11 AC 692 ms
235,812 KB
testcase_12 AC 983 ms
271,372 KB
testcase_13 AC 991 ms
273,296 KB
testcase_14 AC 1,016 ms
273,396 KB
testcase_15 AC 887 ms
257,020 KB
testcase_16 AC 363 ms
151,708 KB
testcase_17 AC 492 ms
175,132 KB
testcase_18 AC 995 ms
273,456 KB
testcase_19 AC 1,037 ms
273,456 KB
testcase_20 AC 1,004 ms
273,104 KB
testcase_21 AC 980 ms
273,104 KB
testcase_22 AC 1,075 ms
273,420 KB
testcase_23 AC 1,001 ms
273,328 KB
testcase_24 AC 1,095 ms
273,116 KB
testcase_25 AC 1,033 ms
273,536 KB
testcase_26 AC 992 ms
273,352 KB
testcase_27 AC 611 ms
203,868 KB
testcase_28 AC 1,024 ms
273,436 KB
testcase_29 AC 1,003 ms
273,352 KB
testcase_30 AC 77 ms
71,332 KB
testcase_31 AC 75 ms
71,260 KB
testcase_32 AC 788 ms
224,492 KB
testcase_33 AC 1,000 ms
273,220 KB
testcase_34 AC 77 ms
71,232 KB
testcase_35 AC 788 ms
224,624 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]

    inf=float("inf")
    DP=[-inf]*(N+1); DP[0]=inf
    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