結果
問題 | No.2666 Decreasing Modulo Nim |
ユーザー | Diana773 |
提出日時 | 2024-03-08 22:16:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 1,524 bytes |
コンパイル時間 | 1,463 ms |
コンパイル使用メモリ | 167,092 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-29 19:47:06 |
合計ジャッジ時間 | 4,154 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 55 |
ソースコード
#include<bits/stdc++.h> template <typename Info> struct SegmentTree { int n; std::vector<Info> info; SegmentTree(int n): n(n-1),info(4<<std::__lg(n)) { } SegmentTree(std::vector<Info> init): SegmentTree(init.size()) { std::function<void(int,int,int)> build= [&] (int pl,int l,int r) { if (l==r) { info[pl]=init[l]; return; } int mid=(l+r)>>1; build(pl*2,l,mid); build(pl*2+1,mid+1,r); pull(pl); }; build (1,1,n); } void pull(int pl) { info[pl]=info[pl*2]+info[pl*2+1]; } void modify(int pl,int l,int r,int x,const Info &v) { if (l==r) { info[pl]=v; return; } int mid=(l+r)>>1; if (x<=mid) modify(pl*2,l,mid,x,v); if (x>mid) modify(pl*2+1,mid+1,r,x,v); pull(pl); } void modify(int x,const Info &v) { modify(1,1,n,x,v); } Info rangeQuery(int pl,int l,int r,int x,int y) { if ((l>y)||(x>r)) return Info(); if ((x<=l)&&(r<=y)) return info[pl]; int mid=(l+r)>>1; return rangeQuery(pl*2,l,mid,x,y)+rangeQuery(pl*2+1,mid+1,r,x,y); } Info rangeQuery(int x,int y) { return rangeQuery(1,1,n,x,y); } }; using namespace std; int _; int n,l,r,m; int a[200010]; int q[500010]; int uu[500010]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n>>m; int fl=0,fll=0,ai=1; for (int i=1; i<=n; i++) { cin>>a[i]; fl=fl^(a[i]/m); fll=fll^(a[i]%m); } if (fl!=0) ai=1; else { if (fll!=0) ai=1; else ai=0; } if (ai) cout<<"Alice"; else cout<<"Bob"; return 0; }