結果

問題 No.103 素因数ゲーム リターンズ
ユーザー konishikonishi
提出日時 2023-11-06 15:45:55
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,735 bytes
コンパイル時間 2,977 ms
コンパイル使用メモリ 255,976 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-11-06 15:46:00
合計ジャッジ時間 4,394 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define pii pair<int,int>
#define pll pair<ll,ll>

#define rep(i,num,n) for(int i=num;i<(int)(n);i++) //for_loop
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,num,n) for(int i=num-1;i>=(int)(n);i--) //reverse_for>
#define in(x,a,b) (a<=x && x<b)//範囲
#define reo return 0
#define all(v) v.begin(),v.end()

#define INFI 1010000000
#define INFL 4000000000000000000
//#define ten(x) ((int)1e##x)
//#define tenll(x) ((ll)1e##x)
#define PI 3.14159265358979
//#define mint modint1000000007
#define mint modint998244353

bool chmin(ll &a,ll b){if(a>b){a=b;return true;}return false;}
bool chmax(ll &a,ll b){if(a<b){a=b;return true;}return false;}
bool chmin(int &a,int b){if(a>b){a=b;return true;}return false;}
bool chmax(int &a,int b){if(a<b){a=b;return true;}return false;}

int dx[]={0,0,1,-1};int dy[]={1,-1,0,0};
//int dx[]={1,1,1,0,0,-1,-1,-1},dy[]={1,0,-1,1,-1,1,0,-1};
//----------------------------
ll n;
int main(){
    cin>>n;

    vector<map<int,int>>fact(n);
    vector<ll>a(n);
    rep(i,0,n)cin>>a[i];
    rep(j,0,n){
            for(ll i=2;i*i<=a[j];i++){
            if(a[j]%i==0)while(a[j]%i==0){
                fact[j][i]++;
                a[j]/=i;
            }
        }
        if(a[j]!=1)fact[j][a[j]]++;
    }
    ll x=0;
    rep(i,0,n){
        ll grundy=0;
        for(auto[key,val]:fact[i]){
        //valを1 or 2減らす不偏ゲーム。
        //grundyは0,1,2,0,1,2...と推移.
        int v=val%3;
        grundy^=v;
        }
        x^=grundy;
    }


    if(x)cout<<"Alice";
    else cout<<"Bob";
    reo;
}
0