結果
| 問題 |
No.361 門松ゲーム2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-17 22:48:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 537 bytes |
| コンパイル時間 | 1,254 ms |
| コンパイル使用メモリ | 165,720 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-04 10:41:08 |
| 合計ジャッジ時間 | 4,825 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 TLE * 1 -- * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int L, D;
int dp[1000];
int g(int L) {
if (dp[L] != -1) return dp[L];
set<int> st;
for (int i = 1; i < L; i++) {
for (int j = i + 1; i + j < L; j++) {
int k = L - i - j;
if (k <= j) continue;
if (k - i <= D) {
st.insert(g(i) ^ g(j) ^ g(k));
}
}
}
int result = 0;
while (st.count(result)) result++;
return result;
}
int main() {
cin >> L >> D;
memset(dp, -1, sizeof(dp));
if (g(L) != 0) {
cout << "kado" << endl;
} else {
cout << "matsu" << endl;
}
}