結果
問題 |
No.361 門松ゲーム2
|
ユーザー |
![]() |
提出日時 | 2016-03-23 16:17:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 993 bytes |
コンパイル時間 | 542 ms |
コンパイル使用メモリ | 66,428 KB |
実行使用メモリ | 13,644 KB |
最終ジャッジ日時 | 2024-10-01 21:31:54 |
合計ジャッジ時間 | 4,060 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 TLE * 1 -- * 19 |
コンパイルメッセージ
main.cpp: In function ‘int game(const std::vector<int>&)’: main.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type] 46 | } | ^
ソースコード
#include <iostream> #include <set> #include <vector> using namespace std; vector<int> memo; int d; int game(const vector<int>& v){ int win = 0; int lose = 0; for(int i=0; i<v.size(); i++){ if(v[i] <= 5) continue; vector<int> vv; for(int j=0; j<v.size(); j++){ if(i!=j) vv.push_back(v[j]); } int L = v[i]; vv.push_back(-1); vv.push_back(-2); vv.push_back(-3); for(int a=1; a<L; a++){ for(int b=a+1; b<L; b++){ int c = L-(a+b); if(c<=b) break; if(a<b && b<c && c-a<=d){ vv[vv.size()-3] = a; vv[vv.size()-2] = b; vv[vv.size()-1] = c; int tmp = game(vv); if(tmp == 1) win = 1; else lose = 1; } } } } if (win == 0 && lose == 0) return 0; else if(win == 1 && lose == 0) return 0; else if(win == 0 && lose == 1) return 1; else if(win == 1 && lose == 1) return 1; } int main(){ int L; cin >> L >> d; memo.resize(L+1, -1); int ans = game({L}); cout << (ans!=0?"kado":"matsu") << endl; return 0; }