結果

問題 No.361 門松ゲーム2
ユーザー yaoshimax
提出日時 2016-04-18 00:33:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 793 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 77,184 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-04 12:21:25
合計ジャッジ時間 2,681 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 = L-x-y;
            if( z <= y ) continue;
            if( z-x >D ) continue;
            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;        
}
0