結果

問題 No.361 門松ゲーム2
ユーザー simansiman
提出日時 2022-11-17 13:25:09
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,170 bytes
コンパイル時間 5,388 ms
コンパイル使用メモリ 131,080 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 05:40:30
合計ジャッジ時間 4,097 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int L, D;
  cin >> L >> D;
  bool is_win[L + 1];
  memset(is_win, false, sizeof(is_win));

  for (int l = 3; l <= L; ++l) {
    bool ok = false;

    for (int a = 1; a <= l; ++a) {
      for (int b = 1; b <= l; ++b) {
        int c = l - a - b;
        if (a + b + c != l) continue;
        if (a == b) continue;
        if (a == c) continue;
        if (b == c) continue;
        if (c <= 0) continue;
        int max_l = max(a, max(b, c));
        int min_l = min(a, min(b, c));
        if (max_l - min_l > D) continue;

        int win_cnt = 0;
        if (is_win[a]) ++win_cnt;
        if (is_win[b]) ++win_cnt;
        if (is_win[c]) ++win_cnt;

        if (win_cnt % 2 == 0) {
          ok = true;
        }
      }
    }

    // fprintf(stderr, "l: %d, res: %d\n", l, ok);
    is_win[l] = ok;
  }

  if (is_win[L]) {
    cout << "kado" << endl;
  } else {
    cout << "matsu" << endl;
  }

  return 0;
}
0