結果

問題 No.103 素因数ゲーム リターンズ
ユーザー bonntanname0316bonntanname0316
提出日時 2020-04-16 11:32:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,498 bytes
コンパイル時間 1,588 ms
コンパイル使用メモリ 170,028 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-09 19:08:46
合計ジャッジ時間 3,787 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 RE -
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 RE -
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};


vec Eratosthenes(ll N){
    vec ret;
    vector<bool> a(N+1,true);
    a.at(0)=false;
    a.at(1)=false;
    REP(i,2,N+1){
        if(a.at(i)) for(ll k=2*i;k<=N;k+=i) a.at(k)=false;
    }
    rep(i,N+1) if(a.at(i)) ret.pb(i);
    return ret;
}

vec Sosu;

void init(ll N){
    ll BIG=N,SMALL=0;
    while(BIG>SMALL+1){
        ll MID=(BIG+SMALL)/2;
        if(MID*MID>=BIG) BIG=MID;
        else SMALL=MID;
    }
    Sosu=Eratosthenes(BIG+3);
}
ll Soin(ll N){
    ll ans=0;
    for(int i=0;Sosu.at(i)*Sosu.at(i)<=N;i++){
        ll k=Sosu.at(i);
        ll count=0;
        while(true){
            if(N%k!=0) break;
            count++;
            N/=k;
        }
        if(count!=0) ans^=(count%3);
    }
    if(N!=1) ans^=1;
    return ans;
}

int main(){
    ll N; cin>>N;
    init(10005);
    vec x(N);
    rep(i,N) cin>>x.at(i);
    ll ans=0;
    rep(i,N) ans^=Soin(x.at(i));
    if(ans) cout<<"Alice"<<endl;
    else cout<<"Bob"<<endl;

}
0