結果
問題 | No.361 門松ゲーム2 |
ユーザー |
![]() |
提出日時 | 2016-04-18 00:37:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 209 ms / 2,000 ms |
コード長 | 849 bytes |
コンパイル時間 | 698 ms |
コンパイル使用メモリ | 78,236 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-10 23:58:56 |
合計ジャッジ時間 | 2,897 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 |
ソースコード
#include <iostream>#include <climits>#include <vector>#include <cstdio>#include <cstring>#include <set>using namespace std;int main(){int L,D;cin >> L >> D;vector<int> grundy(L+1,0);for( int i = 6; i <=L; i++ ){set<int> grundies;for( int x=1; x<=L; x++ ){for( int y=x+1; y<=L; y++ ){int z = i-x-y;if( z <= y ) continue;if( z-x >D ) continue;//cout << i<<"->"<<x<<","<<y<<","<<z<<endl;grundies.insert(grundy[x]^grundy[y]^grundy[z]);}}for( int g = 0 ; g < 500; g++ ){if( grundies.find(g)==grundies.end() ){grundy[i]=g;break;}}}if( grundy[L] == 0){cout << "matsu"<<endl;}else{cout <<"kado"<<endl;}return 0;}