結果

問題 No.103 素因数ゲーム リターンズ
ユーザー autumn-eel
提出日時 2018-01-07 11:50:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 586 bytes
コンパイル時間 1,512 ms
コンパイル使用メモリ 177,756 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 09:55:55
合計ジャッジ時間 2,404 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int dp[20000];
int rec(int n){
	if(dp[n]!=-1)return dp[n];
	int a=n;
	map<int,int>mp;
	for(int i=2;i*i<=a;i++){
		while(a%i==0){
			mp[i]++;a/=i;
		}
	}
	if(a!=1)mp[a]++;
	set<int>se;
	for(auto p:mp){
		se.insert(rec(n/p.first));
		if(p.second>=2)se.insert(rec(n/p.first/p.first));
	}
	int res=0;
	while(se.count(res))res++;
	return dp[n]=res;
}
int main(){
	int n;scanf("%d",&n);
	memset(dp,-1,sizeof(dp));
	int ans=0;
	rep(i,n){
		int m;scanf("%d",&m);
		ans^=rec(m);
	}
	puts(ans?"Alice":"Bob");
}
0