結果

問題 No.361 門松ゲーム2
ユーザー simansiman
提出日時 2022-11-17 13:38:28
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 834 ms / 2,000 ms
コード長 1,022 bytes
コンパイル時間 4,292 ms
コンパイル使用メモリ 132,088 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 05:51:12
合計ジャッジ時間 6,116 ms
ジャッジサーバーID
(参考情報)
judge13 / 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 1 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 3 ms
4,348 KB
testcase_13 AC 3 ms
4,348 KB
testcase_14 AC 413 ms
4,348 KB
testcase_15 AC 14 ms
4,348 KB
testcase_16 AC 280 ms
4,348 KB
testcase_17 AC 121 ms
4,348 KB
testcase_18 AC 45 ms
4,348 KB
testcase_19 AC 109 ms
4,348 KB
testcase_20 AC 14 ms
4,348 KB
testcase_21 AC 288 ms
4,348 KB
testcase_22 AC 834 ms
4,348 KB
testcase_23 AC 96 ms
4,348 KB
testcase_24 AC 95 ms
4,348 KB
testcase_25 AC 105 ms
4,348 KB
testcase_26 AC 151 ms
4,348 KB
testcase_27 AC 175 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;
  int is_win[L + 1];
  memset(is_win, 0, sizeof(is_win));

  for (int l = 1; l <= L; ++l) {
    set<int> S;

    for (int a = 1; a <= l - 2; ++a) {
      for (int b = 1; b <= l - a; ++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;

        S.insert(is_win[a] ^ is_win[b] ^ is_win[c]);
      }
    }

    while (S.count(is_win[l])) {
      is_win[l]++;
    }
  }

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

  return 0;
}
0