結果

問題 No.103 素因数ゲーム リターンズ
ユーザー hogeover30hogeover30
提出日時 2015-03-30 06:04:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 682 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 74,556 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 00:21:33
合計ジャッジ時間 3,388 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <unordered_set>
#include <vector>

int g[10001], c[10001];
using namespace std;
int main()
{
    vector<int> p;
    for(int i=2;i<10001;++i) if (!c[i]) {
        p.push_back(i);
        for(int j=i+i;j<10001;j+=i) c[j]=1;
    }

    g[1]=0;
    for(int i=2;i<10001;++i) {
        unordered_set<int> s;
        for(int j=0;j<p.size();++j) {
            int c=0,n=i;
            while (c++<2 and n%p[j]==0) { n/=p[j]; s.insert(g[n]); }
        }
        g[i]=0;
        while (s.count(g[i])) ++g[i];
    }

    int n;
    while (cin>>n) {
        int x=0;
        while (n--) { int a; cin>>a; x^=g[a]; }
        cout<<(x ? "Alice" : "Bob")<<endl;
    }
}
0