結果
問題 | No.361 門松ゲーム2 |
ユーザー |
![]() |
提出日時 | 2016-04-22 22:05:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 563 bytes |
コンパイル時間 | 1,488 ms |
コンパイル使用メモリ | 167,480 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 15:08:37 |
合計ジャッジ時間 | 1,999 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int L,D;cin >> L >> D;vector<int> gr(L+1,0);for(int l = 0; l <= L; l++){unordered_set<int> memo;for(int l1 = 1; l1 < l; l1++)for(int l2 = l1 + 1; l - (l1 + l2) > l2; l2++){int l3 = l - (l1 + l2);if(l3-l1<=D)memo.insert(gr[l1] ^ gr[l2] ^ gr[l3]);}int v = 0;while(memo.count(v))v++;gr[l] = v;}cout << ((gr[L])?"kado":"matsu") << endl;return 0;}