結果
問題 | No.103 素因数ゲーム リターンズ |
ユーザー |
![]() |
提出日時 | 2020-09-25 00:25:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,062 bytes |
コンパイル時間 | 1,446 ms |
コンパイル使用メモリ | 94,004 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 05:37:32 |
合計ジャッジ時間 | 2,253 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 20 |
ソースコード
#include<iostream> #include<iomanip> #include<cmath> #include<string> #include<cstring> #include<vector> #include<list> #include<algorithm> #include<map> #include<set> #include<queue> #include<stack> using namespace std; typedef long long ll; #define fi first #define se second #define mp make_pair #define mt make_tuple #define pqueue priority_queue const int inf=1e9+7; const ll mod=1e9+7; const ll mod1=998244353; const ll big=1e18; const double PI=2*asin(1); int main() { int N; cin>>N; vector<int> arr(N); int M; int tmpans; for(int i=0;i<N;++i) { cin>>M; vector<int> tmparr; map<int, int> amap; for(int j=2;j*j<=M;++j) { if(M%j==0) tmparr.push_back(j); while(M%j==0) { amap[j]++; M /= j; } } if(M>1) { tmparr.push_back(M); amap[M]++; } tmpans = 0; for(int j=0;j<tmparr.size();++j) tmpans ^= amap[tmparr[j]]%3; arr[i] = tmpans; } int ans = 0; for(int i=0;i<N;++i) { ans ^= arr[i]; } if(ans!=0) cout<<"Alice"<<endl; else cout<<"Bob"<<endl; }