結果
| 問題 |
No.2813 Cookie
|
| コンテスト | |
| ユーザー |
Rubikun
|
| 提出日時 | 2024-07-19 22:40:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 147 ms / 2,000 ms |
| コード長 | 1,570 bytes |
| コンパイル時間 | 1,783 ms |
| コンパイル使用メモリ | 194,608 KB |
| 最終ジャッジ日時 | 2025-02-23 16:45:24 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;
int grundy[305];
bool mita[305][505];
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
for(int n=1;n<=200;n++){
memset(mita,0,sizeof(mita));
mita[0][0]=1;
for(int i=0;i<n;i++){
for(int j=0;j<400;j++){
if(mita[i][j]){
for(int x=1;i+x<=n;x++){
mita[i+x][j^grundy[x]]=true;
}
}
}
}
mita[n][0]=true;
for(int j=0;;j++){
if(!mita[n][j]){
grundy[n]=j;
break;
}
}
//cout<<n<<" "<<grundy[n]<<endl;
}
int Q;cin>>Q;
while(Q--){
ll N;cin>>N;
ll X=0;
for(int i=0;i<N;i++){
ll x;cin>>x;
if(x<=2) X^=1;
else if(x==3) X^=2;
else{
ll T=(x-1)/3;
T*=4;
if(x%3==1) T-=2;
X^=T;
}
}
if(X) cout<<"Alice\n";
else cout<<"Bob\n";
}
}
Rubikun