結果
問題 | No.2204 Palindrome Splitting (No Rearrangement ver.) |
ユーザー | flygon |
提出日時 | 2023-02-03 22:18:34 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 848 bytes |
コンパイル時間 | 500 ms |
コンパイル使用メモリ | 87,128 KB |
実行使用メモリ | 716,868 KB |
最終ジャッジ日時 | 2023-09-15 18:20:20 |
合計ジャッジ時間 | 9,166 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 94 ms
76,260 KB |
testcase_01 | AC | 96 ms
71,724 KB |
testcase_02 | AC | 95 ms
71,508 KB |
testcase_03 | AC | 129 ms
78,684 KB |
testcase_04 | AC | 120 ms
77,880 KB |
testcase_05 | AC | 117 ms
77,992 KB |
testcase_06 | AC | 128 ms
78,852 KB |
testcase_07 | AC | 127 ms
77,992 KB |
testcase_08 | AC | 126 ms
78,308 KB |
testcase_09 | AC | 131 ms
79,448 KB |
testcase_10 | AC | 135 ms
79,160 KB |
testcase_11 | AC | 124 ms
78,404 KB |
testcase_12 | AC | 127 ms
78,384 KB |
testcase_13 | AC | 124 ms
78,340 KB |
testcase_14 | AC | 129 ms
79,020 KB |
testcase_15 | AC | 130 ms
79,248 KB |
testcase_16 | AC | 122 ms
77,988 KB |
testcase_17 | AC | 126 ms
78,656 KB |
testcase_18 | AC | 129 ms
79,040 KB |
testcase_19 | AC | 126 ms
79,196 KB |
testcase_20 | AC | 130 ms
79,080 KB |
testcase_21 | AC | 122 ms
78,536 KB |
testcase_22 | AC | 121 ms
78,292 KB |
testcase_23 | AC | 123 ms
78,460 KB |
testcase_24 | AC | 134 ms
80,488 KB |
testcase_25 | AC | 127 ms
79,052 KB |
testcase_26 | AC | 129 ms
78,804 KB |
testcase_27 | AC | 131 ms
79,624 KB |
testcase_28 | AC | 129 ms
79,080 KB |
testcase_29 | AC | 120 ms
78,316 KB |
testcase_30 | AC | 92 ms
71,764 KB |
testcase_31 | AC | 91 ms
71,848 KB |
testcase_32 | MLE | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
ソースコード
import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd s = list(input().rstrip()) n = len(s) pal = set() for i in range(n): l, r= i,i for j in range(n): ll = l-j rr = r+j if ll < 0 or rr >= n: break if s[ll] == s[rr]: pal.add((ll,rr)) else: break for i in range(n-1): l, r = i, i+1 for j in range(n): ll = l-j rr = r+j if ll < 0 or rr >= n: break if s[ll] == s[rr]: pal.add((ll,rr)) else: break dr = defaultdict(list) for l,r in pal: dr[r].append(l) dp = [1]*(n) for i in range(1, n): for j in dr[i]: if j == 0: dp[i] = i+1 else: dp[i] = max(dp[i],min(i-j+1, dp[j-1])) print(dp[-1])