結果

問題 No.361 門松ゲーム2
ユーザー ei1333333ei1333333
提出日時 2016-04-17 23:57:34
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 1,457 ms
コンパイル使用メモリ 160,276 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-15 02:33:22
合計ジャッジ時間 1,806 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 1 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 WA -
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 1 ms
6,944 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 WA -
testcase_25 AC 1 ms
6,940 KB
testcase_26 WA -
testcase_27 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int64;

int windp[501], losedp[501];
int L, D;

int Winrec(int val)
{
  if(val <= 5) return(false);
  if(~windp[val]) return(windp[val]);
  for(int i = 1; i <= val; i++) {
    for(int j = i + 1; i + j + j + 1 <= val; j++) {
      int k = val - i - j;
      if(k - i > D) continue;

      int proc = Winrec(i) + Winrec(j) + Winrec(k);
      if(proc == 0) {
        return(windp[val] = true);
      } else if(proc == 1) {
      } else if(proc == 2) {
        return(windp[val] = true);
      }
    }
  }
  return(windp[val] = false);
}

int main()
{
  memset(windp, -1, sizeof(windp));
  memset(losedp, -1, sizeof(losedp));

  cin >> L >> D;
  if(Winrec(L)) cout << "kado" << endl;
  else cout << "matsu" << endl;
}
0