結果

問題 No.361 門松ゲーム2
ユーザー ei1333333ei1333333
提出日時 2016-04-17 23:36:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 622 bytes
コンパイル時間 1,132 ms
コンパイル使用メモリ 159,992 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-04-15 02:30:41
合計ジャッジ時間 4,622 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int dp[501];
int L, D;

int rec(int val)
{
  if(val <= 5) return(false);
  if(~dp[val]) return(dp[val]);
  for(int i = 1; i <= val; i++) {
    for(int j = i + 1; i + j <= val; j++) {
      int k = val - i - j;
      if(k <= j) continue;
      if(k - i > D) continue;
      int proc = rec(i) + rec(j) + rec(k);
      if(proc == 0) return(true);
      if(proc == 2) return(true);
    }
  }
  return(dp[val] = false);
}

int main()
{
  memset(dp, -1, sizeof(dp));

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