結果

問題 No.669 対決!!! 飲み比べ
ユーザー imulanimulan
提出日時 2018-03-23 23:26:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,104 bytes
コンパイル時間 1,446 ms
コンパイル使用メモリ 165,396 KB
実行使用メモリ 27,884 KB
最終ジャッジ日時 2023-09-07 04:19:52
合計ジャッジ時間 8,059 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
16,276 KB
testcase_01 AC 4 ms
9,904 KB
testcase_02 AC 832 ms
16,036 KB
testcase_03 AC 3 ms
9,168 KB
testcase_04 AC 8 ms
9,216 KB
testcase_05 AC 23 ms
9,268 KB
testcase_06 AC 1,506 ms
27,884 KB
testcase_07 AC 4 ms
9,164 KB
testcase_08 AC 13 ms
9,316 KB
testcase_09 AC 4 ms
9,144 KB
testcase_10 AC 443 ms
23,424 KB
testcase_11 TLE -
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 <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const int N = 1000001;
int dp[N];
int ct[N];

int g(int n, int k){
    if(dp[n]>=0) return dp[n];

    vector<int> v;
    for(int i=1; i<=k; ++i){
        int r = n-i;
        if(r<0) break;
        ++ct[g(r,k)];
    }

    int ret = 0;
    while(ct[ret]!=0) ++ret;

    for(int i=1; i<=k; ++i){
        int r = n-i;
        if(r<0) break;
        --ct[g(r,k)];
    }

    return dp[n] = ret;
}

int main(){
    int n,k;
    cin >>n >>k;

    memset(dp,-1,sizeof(dp));

    int x = 0;
    rep(i,n){
        int a;
        cin >>a;
        x ^= g(a,k);
    }

    cout << (x==0?"NO":"YES") << endl;
    return 0;
}
0