結果

問題 No.669 対決!!! 飲み比べ
ユーザー sugarrrsugarrr
提出日時 2019-01-17 13:17:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,227 bytes
コンパイル時間 1,628 ms
コンパイル使用メモリ 169,860 KB
実行使用メモリ 11,168 KB
最終ジャッジ日時 2023-09-13 22:44:29
合計ジャッジ時間 5,463 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
11,168 KB
testcase_01 AC 44 ms
11,160 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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E12;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll * pos,ll val){*pos=max(*pos,val);}//Max(&dp[i][j],dp[i-1][j]);
void Min(ll * pos,ll val){*pos=min(*pos,val);}
void Add(ll * pos,ll val){*pos=mod(*pos+val);}
const long double EPS=1E-8;
////////////////////////////////////////

ll n,k;
#define N (ll)1E6+5
ll gru[N];
ll grundy(ll p){
    if(gru[p]!=-1)return gru[p];
    set<ll>s;
    rep(i,1,k){
        if(p-i<0)break;
        s.insert(grundy(p-i));
    }
    ll pos=0;
    while(1){
        if(s.find(pos)!=s.end())pos++;
        else return gru[p]=pos;
    }
}

int main(){
    cin>>n>>k;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    fill(gru,gru+N,-1);
    ll g[n];
    rep(i,0,N-1)grundy(i);
    rep(i,0,n-1)g[i]=grundy(a[i]);
    
    ll sum=0;
    rep(i,0,n-1)sum^=g[i];
    if(sum!=0)cout<<"YES";
    else cout<<"NO";
    
    return 0;
}
0