結果
問題 | No.599 回文かい |
ユーザー | sibasyun |
提出日時 | 2023-12-15 11:29:05 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 898 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 803,480 KB |
最終ジャッジ日時 | 2023-12-15 11:29:20 |
合計ジャッジ時間 | 13,265 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
55,752 KB |
testcase_01 | AC | 43 ms
55,752 KB |
testcase_02 | AC | 43 ms
55,752 KB |
testcase_03 | AC | 43 ms
55,752 KB |
testcase_04 | AC | 55 ms
63,648 KB |
testcase_05 | AC | 52 ms
66,208 KB |
testcase_06 | AC | 46 ms
61,200 KB |
testcase_07 | AC | 48 ms
63,260 KB |
testcase_08 | AC | 47 ms
61,204 KB |
testcase_09 | AC | 51 ms
64,056 KB |
testcase_10 | MLE | - |
testcase_11 | MLE | - |
testcase_12 | MLE | - |
testcase_13 | MLE | - |
testcase_14 | MLE | - |
testcase_15 | MLE | - |
testcase_16 | MLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
evil_0.txt | -- | - |
ソースコード
import io import sys import bisect import math from itertools import permutations, combinations from heapq import heappush, heappop from collections import deque from collections import defaultdict as dd sys.setrecursionlimit(10**7+10) # mod = 998244353 mod = 10**9+7 _INPUT = """\ kaibunkaibunkai """ def main(): T = input() N = len(T) dp = [[-1 for _ in range(N+1)]for _ in range(N+1)] # 区間l,rのときのケース数 def dfs(l, r): if dp[l][r] != -1: return dp[l][r] else: ret = 1 for i in range(r-l): if l+i>=r-1-i:break if T[l:l+i+1] == T[r-1-i:r]: ret += dfs(l+i+1, r-1-i) ret %= mod dp[l][r] = ret return ret dfs(0, N) print(dp[0][N]%mod) if __name__ == "__main__": # sys.stdin = io.StringIO(_INPUT) main()