結果

問題 No.599 回文かい
ユーザー htkbhtkb
提出日時 2019-02-19 19:51:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 302 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 101,980 KB
最終ジャッジ日時 2023-08-02 19:28:04
合計ジャッジ時間 10,724 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,016 KB
testcase_01 AC 72 ms
71,168 KB
testcase_02 AC 71 ms
71,028 KB
testcase_03 AC 71 ms
71,020 KB
testcase_04 AC 75 ms
75,484 KB
testcase_05 AC 81 ms
76,336 KB
testcase_06 AC 72 ms
70,840 KB
testcase_07 AC 72 ms
70,832 KB
testcase_08 AC 71 ms
71,168 KB
testcase_09 AC 75 ms
75,348 KB
testcase_10 AC 79 ms
76,044 KB
testcase_11 AC 78 ms
76,060 KB
testcase_12 AC 88 ms
75,804 KB
testcase_13 AC 91 ms
76,296 KB
testcase_14 AC 1,350 ms
101,980 KB
testcase_15 AC 158 ms
76,916 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