結果

問題 No.103 素因数ゲーム リターンズ
ユーザー imgry22imgry22
提出日時 2014-12-17 23:26:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,354 bytes
コンパイル時間 1,282 ms
コンパイル使用メモリ 144,648 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-09-02 18:41:04
合計ジャッジ時間 3,107 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;

#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, n)    for(int (i)=1; (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, n)    for(int (i)=(n); (i)>=1; (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define EACH(v)       (v).begin(), (v).end()
#define minup(m, x)   (m=min(m, x))
#define maxup(m, x)   (m=max(m, x))
#define mp            make_pair
#define pb            push_back

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

#define MAX_N 100
#define MAX_M 10000
void getNum(int x);

bool isPrime[MAX_M+1];
int n;
int m[MAX_N];
int mx;
int res;

int main()
{
  cin >> n;
  rep(i, n) cin >> m[i];
  rep(i, n) maxup(mx, m[i]);

  getNum(2);
  for(int i=3; i<=mx; i+=2){
    if(!isPrime[i]){
      for(int j=2*i; j<=mx; j+=i){
        isPrime[j] = true;
      }
      getNum(i);
    }
  }

  puts(res ? "Alice" : "Bob");

  return 0;
}

void getNum(int x)
{
  rep(i, n){
    int cnt = 0;
    for(int j=x; m[i]%j==0; j*=x){
      cnt += 1;
    }
    if(cnt) res ^= cnt % 3;
  }
}
0