結果

問題 No.103 素因数ゲーム リターンズ
ユーザー mayoko_mayoko_
提出日時 2015-05-09 22:25:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,517 bytes
コンパイル時間 3,043 ms
コンパイル使用メモリ 157,748 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-19 09:34:45
合計ジャッジ時間 3,110 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;

const int MAXN = 10010;

map<ll, int> bunkai(ll N) {
    map<ll, int> ret;
    for (ll i = 2; i * i <= N; i++) {
        if (N % i == 0) {
            while (N%i == 0) {
                ret[i]++;
                N /= i;
            }
        }
    }
    if (N>1) ret[N]++;
    return ret;
}

int g[MAXN];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> nums;
    for (int i = 0; i < N; i++) {
        int M;
        cin >> M;
        auto m = bunkai(M);
        for (auto p : m) {
            nums.push_back(p.second);
        }
    }
    int m = nums.size();
    for (int i = 0; i < m; i++) {
        set<int> S;
        for (int minus = 1; minus <= 2; minus++) {
            int x = 0;
            if (nums[i]-minus < 0) continue;
            for (int j = 0; j < m; j++) {
                if (j != i) x ^= nums[j];
                else x ^= (nums[i]-minus);
            }
            S.insert(x);
        }
        int cur = 0;
        for (int el : S) {
            if (el <= cur) cur = el+1;
            else break;
        }
        g[i] = cur;
    }
    int x = 0;
    for (int i = 0; i < m; i++) {
        x ^= g[i];
    }
    if (x == 0) cout << "Bob" << endl;
    else cout << "Alice" << endl;
    return 0;
}
0