結果

問題 No.361 門松ゲーム2
ユーザー kurenai3110
提出日時 2016-09-13 23:42:54
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 527 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 64,328 KB
実行使用メモリ 16,840 KB
最終ジャッジ日時 2024-11-17 05:10:36
合計ジャッジ時間 50,013 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 TLE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
using namespace std;
int L, D;

int grundy(int l) {
	set<int> s;
	for (int i = 1; i <= l; i++) {
		for (int j = i + 1; j <= l - i; j++) {
			for (int k = j + 1; k <= l-i-j; k++) {
				if (k - i > D)break;
				if (i + j + k != l) continue;
				s.insert(grundy(i) ^ grundy(j) ^ grundy(k));
			}
		}
	}
	int res = 0;
	while (s.count(res)) res++;
	return res;
}

int main()
{
	cin >> L >> D;

	if (grundy(L)) {
		cout << "kado" << endl;
	}
	else {
		cout << "matsu" << endl;
	}
    
	return		0;
}
0