結果
| 問題 |
No.599 回文かい
|
| コンテスト | |
| ユーザー |
Bioinfo_K
|
| 提出日時 | 2017-11-25 10:45:10 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 395 bytes |
| コンパイル時間 | 80 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 44,160 KB |
| 最終ジャッジ日時 | 2024-11-27 09:54:24 |
| 合計ジャッジ時間 | 23,356 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 TLE * 4 |
ソースコード
import sys,collections
mod = 10**9+7
sys.setrecursionlimit(mod)
s= input()
d = collections.defaultdict(lambda: 1)
def DFS(s):
if s in d:
return d[s]
rh1,rh2 = 0,0
for i in range(1,len(s)//2+1):
rh1 = rh1 + ord(s[i-1])*(2**i)
rh2 = (rh2+ord(s[-i]))*2
if rh1 == rh2 and s[:i] == s[-i:]:
d[s] += DFS(s[i:-i])
return d[s]
print(DFS(s)%mod)
Bioinfo_K