結果

問題 No.669 対決!!! 飲み比べ
ユーザー DameningenDameningen
提出日時 2018-03-23 23:04:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,179 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 96,032 KB
実行使用メモリ 9,724 KB
最終ジャッジ日時 2023-09-07 04:06:37
合計ジャッジ時間 4,487 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
9,724 KB
testcase_01 AC 3 ms
5,472 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
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 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define pb push_back
#define mk make_pair
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 1e6, MAX_A = 1e6;

int n, k;
int a[MAX_N];

int grendy[MAX_A+1];


int main() {
  cin >> n >> k;
  rep(i,n) cin >> a[i];

  grendy[0] = 0;

  int max_a = *max_element(a, a+n);

  for (int j = 1; j <= max_a; ++j) {
    set<int> s;
    for (int i = 1; i <= k; ++i) {
      if (i <= j) s.insert(grendy[j - i]);
    }

    int g = 0;
    while (s.count(g) != 0) ++g;
    grendy[j] = g;
  }

  int win = 0;
  for (int i = 0; i < n; ++i) win ^= grendy[a[i]];

  if (win != 0) puts("YES");
  else puts("NO");

  return 0;
}

0