結果
問題 |
No.361 門松ゲーム2
|
ユーザー |
![]() |
提出日時 | 2017-02-22 15:52:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 613 bytes |
コンパイル時間 | 2,167 ms |
コンパイル使用メモリ | 170,932 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-12-30 18:44:32 |
合計ジャッジ時間 | 8,944 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 TLE * 1 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) int L, D; //----------------------------------------------------------------- int memo[501]; int nim(int x) { if (0 <= memo[x]) return memo[x]; set<int> g; rep(i, 1, x) rep(j, i + 1, x) rep(k, j + 1, x) { if (i + j + k != x) continue; if (D < k - i) continue; g.insert(nim(i) ^ nim(j) ^ nim(k)); } int ret = 0; for (int i : g) if (ret == i) ret++; return memo[x] = ret; } int main() { cin >> L >> D; rep(i, 0, 501) memo[i] = -1; int g = nim(L); if (g != 0) printf("kado\n"); else printf("matsu\n"); }