結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2015-12-07 00:17:20 |
言語 | Python2 (2.7.18) |
結果 |
MLE
|
実行時間 | - |
コード長 | 315 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 1,283,000 KB |
最終ジャッジ日時 | 2024-09-14 17:00:05 |
合計ジャッジ時間 | 4,574 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | MLE * 1 -- * 16 |
ソースコード
#!/usr/bin/pythonimport sysif sys.version_info[0]>=3: raw_input=inputsys.setrecursionlimit(1000000)memo={}def dfs(k,p,d):if k<0 or p<0: return 0if d==0: return 1x=tuple([k,p,d])if x not in memo:memo[x]=(dfs(k-1,1,d-1)+dfs(2,p-1,d-1))%1000000007return memo[x]n=int(raw_input())print(dfs(2,0,n))