結果

問題 No.103 素因数ゲーム リターンズ
ユーザー kyo1
提出日時 2022-06-30 18:21:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 697 bytes
コンパイル時間 2,033 ms
コンパイル使用メモリ 196,388 KB
最終ジャッジ日時 2025-01-30 01:59:49
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

vector<int> factorize(int n) {
  vector<int> res;
  for (int i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      res.push_back(i);
      n /= i;
    }
  }
  if (n > 1) res.push_back(n);
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  vector<int> M(N);
  for (auto&& e : M) {
    cin >> e;
  }
  int res = 0;
  for (const auto& e : M) {
    int m = e;
    for (int i = 2; i * i <= m; i++) {
      int c = 0;
      while (m % i == 0) {
        m /= i;
        c++;
      }
      res ^= c % 3;
    }
    if (m > 1) res ^= 1;
  }
  cout << (res == 0 ? "Bob" : "Alice") << '\n';
  return 0;
}
0