結果

問題 No.2813 Cookie
ユーザー RubikunRubikun
提出日時 2024-07-19 22:40:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 1,570 bytes
コンパイル時間 2,011 ms
コンパイル使用メモリ 201,072 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 22:40:45
合計ジャッジ時間 6,996 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
5,248 KB
testcase_01 AC 118 ms
5,248 KB
testcase_02 AC 121 ms
5,376 KB
testcase_03 AC 125 ms
5,376 KB
testcase_04 AC 134 ms
5,376 KB
testcase_05 AC 120 ms
5,376 KB
testcase_06 AC 119 ms
5,376 KB
testcase_07 AC 123 ms
5,376 KB
testcase_08 AC 118 ms
5,376 KB
testcase_09 AC 120 ms
5,376 KB
testcase_10 AC 122 ms
5,376 KB
testcase_11 AC 123 ms
5,376 KB
testcase_12 AC 121 ms
5,376 KB
testcase_13 AC 135 ms
5,376 KB
testcase_14 AC 123 ms
5,376 KB
testcase_15 AC 120 ms
5,376 KB
testcase_16 AC 122 ms
5,376 KB
testcase_17 AC 125 ms
5,376 KB
testcase_18 AC 126 ms
5,376 KB
testcase_19 AC 120 ms
5,376 KB
testcase_20 AC 120 ms
5,376 KB
testcase_21 AC 124 ms
5,376 KB
testcase_22 AC 138 ms
5,376 KB
testcase_23 AC 120 ms
5,376 KB
testcase_24 AC 121 ms
5,376 KB
testcase_25 AC 122 ms
5,376 KB
testcase_26 AC 111 ms
5,376 KB
testcase_27 AC 108 ms
5,376 KB
testcase_28 AC 110 ms
5,376 KB
testcase_29 AC 109 ms
5,376 KB
testcase_30 AC 106 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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";
    }
}
0