結果
問題 | No.314 ケンケンパ |
ユーザー |
|
提出日時 | 2015-12-07 00:31:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 94 ms / 1,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 636 ms |
コンパイル使用メモリ | 40,448 KB |
実行使用メモリ | 79,744 KB |
最終ジャッジ日時 | 2024-09-14 17:07:50 |
合計ジャッジ時間 | 1,774 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d",&n); | ~~~~~^~~~~~~~~
ソースコード
#include <unordered_map>#include <cstdio>using namespace std;//unordered_map<int,int>memo;int memo[8000008];int dfs(int k,int p,int d){if(k<0||p<0)return 0;if(d==0)return 1;auto x=(d<<3)|(k<<1)|p;//if(memo.find(x)!=memo.end())return memo[x];if(memo[x])return memo[x];return memo[x]=(dfs(k-1,1,d-1)+dfs(2,p-1,d-1))%1000000007;}int main(){int n;scanf("%d",&n);printf("%d\n",dfs(2,0,n));}