結果

問題 No.669 対決!!! 飲み比べ
ユーザー sugarrrsugarrr
提出日時 2019-01-17 13:21:58
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 1,323 bytes
コンパイル時間 1,526 ms
コンパイル使用メモリ 171,532 KB
実行使用メモリ 11,436 KB
最終ジャッジ日時 2023-09-13 22:44:59
合計ジャッジ時間 3,172 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
11,208 KB
testcase_01 AC 16 ms
11,156 KB
testcase_02 AC 16 ms
11,160 KB
testcase_03 AC 17 ms
11,272 KB
testcase_04 AC 16 ms
11,196 KB
testcase_05 AC 16 ms
11,200 KB
testcase_06 AC 16 ms
11,208 KB
testcase_07 AC 16 ms
11,168 KB
testcase_08 AC 16 ms
11,336 KB
testcase_09 AC 16 ms
11,164 KB
testcase_10 AC 16 ms
11,148 KB
testcase_11 AC 16 ms
11,172 KB
testcase_12 AC 16 ms
11,336 KB
testcase_13 AC 16 ms
11,332 KB
testcase_14 AC 16 ms
11,436 KB
testcase_15 AC 16 ms
11,192 KB
testcase_16 AC 16 ms
11,168 KB
testcase_17 AC 16 ms
11,336 KB
testcase_18 AC 17 ms
11,168 KB
testcase_19 AC 16 ms
11,208 KB
testcase_20 AC 16 ms
11,260 KB
testcase_21 AC 16 ms
11,144 KB
testcase_22 AC 16 ms
11,224 KB
testcase_23 AC 17 ms
11,160 KB
testcase_24 AC 16 ms
11,152 KB
testcase_25 AC 16 ms
11,336 KB
testcase_26 AC 16 ms
11,188 KB
testcase_27 AC 16 ms
11,260 KB
testcase_28 AC 16 ms
11,152 KB
権限があれば一括ダウンロードができます

ソースコード

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)cout<<grundy(i)<<" ";cout<<endl;
    rep(i,0,N-1)gru[i]=i%(k+1);
    //rep(i,0,N-1)cout<<i%(k+1)<<" ";
    rep(i,0,n-1)g[i]=gru[a[i]];
    
    ll sum=0;
    rep(i,0,n-1)sum^=g[i];
    if(sum!=0)cout<<"YES";
    else cout<<"NO";
    
    return 0;
}
0