結果

問題 No.2204 Palindrome Splitting (No Rearrangement ver.)
ユーザー ニックネームニックネーム
提出日時 2023-02-03 22:18:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 945 ms / 2,000 ms
コード長 400 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 86,964 KB
実行使用メモリ 175,544 KB
最終ジャッジ日時 2023-09-15 18:21:26
合計ジャッジ時間 19,259 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,332 KB
testcase_01 AC 73 ms
71,412 KB
testcase_02 AC 74 ms
71,352 KB
testcase_03 AC 354 ms
134,204 KB
testcase_04 AC 149 ms
90,080 KB
testcase_05 AC 128 ms
84,296 KB
testcase_06 AC 542 ms
175,084 KB
testcase_07 AC 550 ms
164,916 KB
testcase_08 AC 479 ms
156,640 KB
testcase_09 AC 696 ms
160,768 KB
testcase_10 AC 643 ms
175,388 KB
testcase_11 AC 461 ms
156,488 KB
testcase_12 AC 546 ms
174,420 KB
testcase_13 AC 538 ms
175,520 KB
testcase_14 AC 625 ms
175,328 KB
testcase_15 AC 625 ms
167,444 KB
testcase_16 AC 265 ms
114,832 KB
testcase_17 AC 351 ms
126,348 KB
testcase_18 AC 563 ms
175,392 KB
testcase_19 AC 668 ms
175,476 KB
testcase_20 AC 603 ms
175,336 KB
testcase_21 AC 555 ms
175,436 KB
testcase_22 AC 582 ms
175,360 KB
testcase_23 AC 620 ms
175,384 KB
testcase_24 AC 750 ms
175,212 KB
testcase_25 AC 724 ms
175,460 KB
testcase_26 AC 527 ms
175,480 KB
testcase_27 AC 539 ms
140,644 KB
testcase_28 AC 642 ms
175,544 KB
testcase_29 AC 537 ms
175,448 KB
testcase_30 AC 73 ms
71,328 KB
testcase_31 AC 72 ms
71,372 KB
testcase_32 AC 931 ms
150,940 KB
testcase_33 AC 601 ms
175,328 KB
testcase_34 AC 71 ms
71,308 KB
testcase_35 AC 945 ms
151,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input(); n = len(s)
f = [[False]*(i+1) for i in range(n)]
for i in range(n): f[i][i] = True
for i in range(n-1):
    if s[i]==s[i+1]: f[i+1][i] = True
for d in range(3,n+1):
    for l in range(n-d+1):
        if s[l]==s[l+d-1] and f[l+d-2][l+1]: f[l+d-1][l] = True
dp = [0]*n+[n]
for r in range(n):
    for l in range(r+1):
        if f[r][l]: dp[r] = max(dp[r],min(dp[l-1],r-l+1))
print(dp[n-1])
0