結果

問題 No.2204 Palindrome Splitting (No Rearrangement ver.)
ユーザー tassei903tassei903
提出日時 2023-02-04 10:53:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 799 ms / 2,000 ms
コード長 784 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 273,280 KB
最終ジャッジ日時 2023-09-16 07:58:07
合計ジャッジ時間 19,876 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,144 KB
testcase_01 AC 72 ms
70,996 KB
testcase_02 AC 76 ms
71,092 KB
testcase_03 AC 403 ms
190,048 KB
testcase_04 AC 154 ms
102,624 KB
testcase_05 AC 133 ms
90,956 KB
testcase_06 AC 609 ms
273,036 KB
testcase_07 AC 536 ms
251,924 KB
testcase_08 AC 518 ms
235,600 KB
testcase_09 AC 727 ms
243,376 KB
testcase_10 AC 774 ms
273,280 KB
testcase_11 AC 488 ms
235,188 KB
testcase_12 AC 626 ms
271,300 KB
testcase_13 AC 581 ms
273,112 KB
testcase_14 AC 693 ms
273,060 KB
testcase_15 AC 679 ms
256,572 KB
testcase_16 AC 277 ms
150,920 KB
testcase_17 AC 405 ms
174,920 KB
testcase_18 AC 630 ms
273,108 KB
testcase_19 AC 714 ms
273,100 KB
testcase_20 AC 674 ms
272,960 KB
testcase_21 AC 581 ms
273,248 KB
testcase_22 AC 704 ms
273,168 KB
testcase_23 AC 671 ms
273,164 KB
testcase_24 AC 799 ms
273,000 KB
testcase_25 AC 716 ms
273,232 KB
testcase_26 AC 580 ms
273,168 KB
testcase_27 AC 521 ms
203,052 KB
testcase_28 AC 705 ms
273,212 KB
testcase_29 AC 578 ms
273,068 KB
testcase_30 AC 74 ms
71,264 KB
testcase_31 AC 71 ms
71,192 KB
testcase_32 AC 734 ms
224,276 KB
testcase_33 AC 666 ms
272,996 KB
testcase_34 AC 74 ms
70,948 KB
testcase_35 AC 723 ms
224,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
s = input()
n = len(s)

dp = [[0 for j in range(n+1)]for i in range(n)]

for i in range(n):
    dp[i][i+1] = 1
    dp[i][i] = 1

for d in range(2,n+1):
    for i in range(n-d+1):
        j = i + d
        if s[i] == s[j-1]:
            dp[i][j] = dp[i+1][j-1]

ans = [0] * (n+1)
ans[0] = 10**9

for i in range(n):
    for j in range(i+1, n+1):
        if dp[i][j]:
            ans[j] = max(ans[j], min(ans[i], j-i))

print(ans[n])
0