結果
| 問題 |
No.2 素因数ゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-15 15:39:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,547 bytes |
| コンパイル時間 | 2,044 ms |
| コンパイル使用メモリ | 176,896 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-10-01 18:46:24 |
| 合計ジャッジ時間 | 3,292 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 RE * 3 |
ソースコード
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());
const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};
vec Eratosthenes(ll N){
vec ret;
vector<bool> a(N+1,true);
a.at(0)=false;
a.at(1)=false;
REP(i,2,N+1){
if(a.at(i)) for(ll k=2*i;k<=N;k+=i) a.at(k)=false;
}
rep(i,N+1) if(a.at(i)) ret.pb(i);
return ret;
}
vector<P> Soin(ll N){
ll BIG=N, SMALL=0;
while(BIG>SMALL+1){
ll MID=(BIG+SMALL)/2;
if(MID*MID>N) BIG=MID;
else SMALL=MID;
}
vec Sosu=Eratosthenes(BIG);
vector<P> ret;
for(int i=0;Sosu.at(i)*Sosu.at(i)<=N;i++){
ll k=Sosu.at(i);
ll count=0;
while(true){
if(N%k!=0) break;
count++;
N/=k;
}
if(count!=0) ret.pb(mp(k,count));
}
if(N!=1) ret.pb(mp(N,1));
return ret;
}
ll Nim(ll x){
vector<P> y=Soin(x);
ll ret=0;
rep(i,y.size()) {
ll kari=y.at(i).second;
ret=(ret^kari);
}
return ret;
}
int main(){
ll N; cin>>N;
if(Nim(N)) cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
}