結果
| 問題 |
No.103 素因数ゲーム リターンズ
|
| コンテスト | |
| ユーザー |
iomir
|
| 提出日時 | 2023-04-29 01:35:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 284 ms / 5,000 ms |
| コード長 | 1,011 bytes |
| コンパイル時間 | 1,868 ms |
| コンパイル使用メモリ | 172,032 KB |
| 実行使用メモリ | 81,556 KB |
| 最終ジャッジ日時 | 2024-11-18 00:06:39 |
| 合計ジャッジ時間 | 9,584 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 20 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define all(v) v.begin(),v.end()
using ll = long long;
using ull = unsigned long long;
using vll=vector<ll>;
using vvll = vector<vector<ll>>;
const ll INF=1ll<<60;
using vp=vector<pair<ll, ll>>;
int main(){
ll N;
cin>>N;
vll A(N);
for(auto &e:A) cin >>e;
vector<ll> pri(1e7);
for(int i=0;i<=1e7;i++) pri[i]=i;
for(ll i=2;i<=1e7;i++){
if(pri[i]!=i) continue;
ll j=1;
while(i*j<=1e7){
pri[i*j]=min(i,pri[i*j]);
j++;
}
}
vll B;
for(int i=0;i<N;i++){
ll now=pri[A[i]];
ll cnt=0;
while(A[i]>1){
if(now==pri[A[i]])A[i]/=pri[A[i]],cnt++;
else{
B.push_back(cnt%3);
now=pri[A[i]];
A[i]/=pri[A[i]];
cnt=1;
}
}
B.push_back(cnt%3);
}
ll a=0;
for(auto x:B) a^=x;
if(a) cout << "Alice" << endl;
else cout << "Bob" << endl;
}
iomir