結果

問題 No.2204 Palindrome Splitting (No Rearrangement ver.)
ユーザー 👑 KazunKazun
提出日時 2023-02-04 01:13:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 492 bytes
コンパイル時間 865 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 273,516 KB
最終ジャッジ日時 2023-09-15 21:39:47
合計ジャッジ時間 56,913 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,356 KB
testcase_01 AC 76 ms
71,112 KB
testcase_02 AC 73 ms
71,348 KB
testcase_03 AC 1,027 ms
190,392 KB
testcase_04 AC 245 ms
103,220 KB
testcase_05 AC 171 ms
91,520 KB
testcase_06 TLE -
testcase_07 AC 1,753 ms
251,876 KB
testcase_08 AC 1,578 ms
235,752 KB
testcase_09 AC 1,648 ms
243,884 KB
testcase_10 TLE -
testcase_11 AC 1,554 ms
235,732 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 1,829 ms
257,208 KB
testcase_16 AC 624 ms
151,596 KB
testcase_17 AC 854 ms
175,244 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 AC 1,151 ms
203,628 KB
testcase_28 TLE -
testcase_29 TLE -
testcase_30 AC 73 ms
71,108 KB
testcase_31 AC 73 ms
71,340 KB
testcase_32 AC 1,502 ms
224,352 KB
testcase_33 TLE -
testcase_34 AC 73 ms
71,420 KB
testcase_35 AC 1,523 ms
224,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    E=[[r-l<=1 for r in range(N+2)] for l in range(N+2)]
    for k in range(1,N+1):
        for l in range(N-k+2):
            E[l][l+k]=(S[l]==S[l+k-1]) and E[l+1][l+k-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