結果

問題 No.2813 Cookie
ユーザー warabi0906
提出日時 2024-07-13 12:57:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 634 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 64,356 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-13 13:06:42
合計ジャッジ時間 2,884 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int N,A[200005],X;
int g(int x)
{
    if(x<3)
    {
        return 1;
    }
    else if(x<5)
    {
        return 2;
    }
    else
    {
        if(x%3==1)
        {
            return (x-4)/3*4+2;
        }
        else
        {
            return (x-2)/3*4;
        }
    }
}
void solve()
{
    cin>>N;
    for(int i=0;i<N;i++)cin>>A[i];
    X=0;
    for(int i=0;i<N;i++)
    {
        X^=g(A[i]);
    }
    if(X)
    {
        cout<<"Alice\n";
    }
    else
    {
        cout<<"Bob\n";
    }
    return;
}
int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        solve();
    }
}
0