結果
| 問題 |
No.669 対決!!! 飲み比べ
|
| コンテスト | |
| ユーザー |
sugarrr
|
| 提出日時 | 2019-01-17 13:18:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,228 bytes |
| コンパイル時間 | 1,647 ms |
| コンパイル使用メモリ | 172,512 KB |
| 実行使用メモリ | 11,404 KB |
| 最終ジャッジ日時 | 2024-07-01 06:58:10 |
| 合計ジャッジ時間 | 2,877 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 WA * 5 |
ソースコード
#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)gru[i]=i%k;
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;
}
sugarrr