結果
問題 | No.669 対決!!! 飲み比べ |
ユーザー |
![]() |
提出日時 | 2019-01-17 13:21:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 1,323 bytes |
コンパイル時間 | 1,620 ms |
コンパイル使用メモリ | 173,804 KB |
実行使用メモリ | 11,332 KB |
最終ジャッジ日時 | 2024-07-01 06:58:30 |
合計ジャッジ時間 | 2,920 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 25 |
ソースコード
#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_backll 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+5ll 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;}