結果
問題 | No.361 門松ゲーム2 |
ユーザー |
|
提出日時 | 2019-12-08 15:27:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 2,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 838 ms |
コンパイル使用メモリ | 64,776 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 13:21:05 |
合計ジャッジ時間 | 2,194 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
コンパイルメッセージ
main.cpp: In function 'int dfs(int)': main.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type] 21 | } | ^
ソースコード
#include<iostream>using namespace std;int grundy[500] = {};bool done[500] = {};int l, d;int dfs(int x){if(done[x]) return grundy[x];done[x] = true;bool memo[1000] = {};for(int i = 1; i < x/3; i++){for(int j = i+1; x-i-j > j; j++){if(x-i-j-i > d) continue;memo[dfs(i)^dfs(j)^dfs(x-i-j)] = true;}}for(int i = 0; i < 1000; i++){if(!memo[i]) return grundy[x] = i;}}int main(){cin >> l >> d;cout << (dfs(l)==0 ? "matsu" : "kado") << endl;return 0;}