結果

問題 No.599 回文かい
ユーザー htkbhtkb
提出日時 2019-02-19 19:51:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 302 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 102,144 KB
最終ジャッジ日時 2024-04-20 19:34:05
合計ジャッジ時間 7,659 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 38 ms
52,096 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 AC 38 ms
51,456 KB
testcase_04 AC 46 ms
58,496 KB
testcase_05 AC 47 ms
62,592 KB
testcase_06 AC 36 ms
52,480 KB
testcase_07 AC 36 ms
52,224 KB
testcase_08 AC 35 ms
51,968 KB
testcase_09 AC 42 ms
59,520 KB
testcase_10 AC 53 ms
75,260 KB
testcase_11 AC 56 ms
74,752 KB
testcase_12 AC 65 ms
75,136 KB
testcase_13 AC 65 ms
75,520 KB
testcase_14 AC 1,094 ms
96,000 KB
testcase_15 AC 117 ms
76,288 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
evil_0.txt -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)

s = input()
length = len(s) // 2
s, s_rev = s[:length], s[(len(s)+1)//2:]
mod = 10**9+7
dp = [0]*(length+1)


def rec(i):
    dp[i] = (sum(dp[j] or rec(j) for j in range(i+1, length+1) if s[i:j] == s_rev[-j:length-i]) + 1) % mod
    return dp[i]


print(rec(0))
0