結果
問題 |
No.361 門松ゲーム2
|
ユーザー |
|
提出日時 | 2016-04-18 00:31:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 875 bytes |
コンパイル時間 | 659 ms |
コンパイル使用メモリ | 60,032 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-04 12:18:17 |
合計ジャッジ時間 | 1,576 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 9 |
ソースコード
#include <iostream> #include <vector> using namespace std; int main() { int l, d; vector< int > memo(500,-1); vector< int > table(500,0); cin >> l >> d; for(int i=0;i<5;++i){ memo[i] = 0; } for(int i=5;i<l;++i){ for(int j=0;j<500;++j)table[j] = 0; for(int x=1;x<=(i+1)/2;++x){ for(int y=x+1;y<=(i+1-x)/2;++y){ int z = i + 1 - x - y; if(z - x <= d && x!=y && y!=z && x!=z){ if(x<=5 && y<=5 && z<=5)table[0] = 1; else if(x<=5 && y<=5)table[memo[z-1]] = 1; else if(x<=5){ table[memo[y-1]] = 1; table[memo[z-1]] = 1; }else{ table[memo[x-1]] = 1; table[memo[y-1]] = 1; table[memo[z-1]] = 1; } } } } for(int j=0;j<500;++j){ if(table[j]!=1){ memo[i] = j; break; } } } if(memo[l-1]){ cout << "kado" << endl; }else{ cout << "matsu" << endl; } return 0; }