結果

問題 No.103 素因数ゲーム リターンズ
ユーザー ちいかわ
提出日時 2025-05-25 04:13:23
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,199 bytes
コンパイル時間 2,907 ms
コンパイル使用メモリ 283,580 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-25 04:13:28
合計ジャッジ時間 4,169 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
random_device seed_gen;
mt19937_64 rnd(seed_gen());
template <typename T> bool chmax(T& A, T B) { if (A < B) { A = B; return true; } return false; }
template <typename T> bool chmin(T& A, T B) { if (A > B) { A = B; return true; } return false; }
#define rep(i, m, n) for (int i = (m); i < (n); i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using ll = long long;
using pint = pair<int, int>;
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>;
#define PI 3.14159265358979323846264338327950288419716939937510
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    int xs = 0;
    rep (i, 0, n) {
        int m;
        cin >> m;
        int c = 0, t = m;
        map<int, int> mp;
        for (int j = 2; j * j <= m; j++) {
            while (t % j == 0) {
                t /= j;
                mp[j]++;
            }
        }
        if (t != 1) {
            mp[t]++;
        }
        for (auto [_, x] : mp) {
            xs ^= x % 3;
        }
    }
    cout << (xs ? "Alice" : "Bob") << endl;
    return 0;
}
0