結果

問題 No.103 素因数ゲーム リターンズ
ユーザー こんのゆうたこんのゆうた
提出日時 2023-05-06 14:09:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,703 bytes
コンパイル時間 1,677 ms
コンパイル使用メモリ 169,536 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-15 14:30:05
合計ジャッジ時間 2,786 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, j, n) for (ll i = (j); (i) < (n); ++(i))
#define pre(i,x) for(ll i=((ll)(x)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (x).size()
#define pb push_back
#define fs first
#define sd second
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define pll pair<ll, ll>
#define vpll vector<pair<ll, ll>>
#define mp make_pair
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } }//最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }//最小公倍数
bool comp(pll& f, pll& s) { return f.second < s.second; }//昇順に並び替える比較関数
const double PI = 3.141592653589793;
const int INF32 = 1 << 30, dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const ll INF = 1ll << 60;
const ll MOD = 998244353;//1000000007;

vector<ll> prime_factorize(ll val) {
	vector<ll> res;
	for (ll i = 2; i * i <= val; ++i) {
		if (val % i != 0) continue;
		ll ex = 0;
		while (val % i == 0) {
			++ex;
			val /= i;
		}
		res.push_back(ex);
	}
	if (val != 1) res.push_back(1);
	return res;
};
int main() {
	ll N; cin >> N;
	vll M(N);
	vll gr(N,0);
	rep(i, N) {
		cin >> M[i];
		vll _M = prime_factorize(M[i]);
		rep(j, _M.size()) {
			_M[j] %= 3;
		}
		rep(j, _M.size()) {
			gr[i] ^= _M[j];
		}
	}
	ll _gr = 0;
	rep(i, N)_gr ^= gr[i];
	if (_gr)cout << "Alice" << endl;
	else cout << "Bob" << endl;
	return 0;
}
0