結果
問題 |
No.361 門松ゲーム2
|
ユーザー |
![]() |
提出日時 | 2019-04-30 03:05:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 923 bytes |
コンパイル時間 | 2,460 ms |
コンパイル使用メモリ | 164,804 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-26 00:32:47 |
合計ジャッジ時間 | 6,928 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 TLE * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll INFL = 1000000000000000010;//10^18 = 2^60 int INF = 2000000000;//10^9 ll MOD = 998244353; vector<int> memo(510, -1); int grundy(int L, int D){ if(memo[L] != -1){ return memo.at(L); } set<int> s; for(int i = 1; i < L; i++){ for(int j = i+1; j < L; j++){ for(int k = j+1; k < L; k++){ if(i + j + k == L && k - i <= D){ s.insert(grundy(i, D) xor grundy(j, D) xor grundy(k, D)); }else{ continue; } } } } int res = 0; while(s.count(res)) res++; return memo.at(L) = res; } int main() { int L,D; cin >> L >> D; for(int i = 0; i < 510; i++) memo.at(L) = -1; if(grundy(L, D)){ cout << "kado" << endl; }else{ cout << "matsu" << endl; } }