結果

問題 No.103 素因数ゲーム リターンズ
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2022-10-14 04:25:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 1,336 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 80,248 KB
最終ジャッジ日時 2023-09-08 19:24:20
合計ジャッジ時間 4,933 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
80,244 KB
testcase_01 AC 114 ms
79,856 KB
testcase_02 AC 115 ms
80,032 KB
testcase_03 AC 113 ms
80,180 KB
testcase_04 AC 112 ms
79,980 KB
testcase_05 AC 111 ms
80,020 KB
testcase_06 AC 112 ms
79,944 KB
testcase_07 AC 113 ms
79,944 KB
testcase_08 AC 112 ms
79,856 KB
testcase_09 AC 110 ms
79,980 KB
testcase_10 AC 113 ms
80,116 KB
testcase_11 AC 110 ms
80,120 KB
testcase_12 AC 112 ms
80,168 KB
testcase_13 AC 113 ms
80,248 KB
testcase_14 AC 113 ms
80,032 KB
testcase_15 AC 111 ms
80,212 KB
testcase_16 AC 111 ms
79,948 KB
testcase_17 AC 113 ms
80,108 KB
testcase_18 AC 112 ms
80,092 KB
testcase_19 AC 113 ms
80,028 KB
testcase_20 AC 115 ms
80,024 KB
testcase_21 AC 117 ms
80,144 KB
testcase_22 AC 117 ms
80,040 KB
testcase_23 AC 118 ms
80,200 KB
testcase_24 AC 117 ms
80,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import sys,math
input = sys.stdin.readline


N = int(input())
M = list(map(int,input().split()))
class prime_factorize():
    
    def __init__(self,M=10**6):
        self.sieve = [-1]*(M+1)
        self.sieve[1] = 1
        self.p = [False]*(M+1)
        self.mu = [1]*(M+1)
        
        for i in range(2,M+1):
            if self.sieve[i] == -1:
                self.p[i] = True
                
                i2 = i**2
                for j in range(i2,M+1,i2):
                    
                    self.mu[j] = 0
                
                
                for j in range(i,M+1,i):
                    self.sieve[j] = i
                    
                    self.mu[j] *= -1
                    
    def factors(self,x):
        tmp = []
        while self.sieve[x] != x:
            tmp.append(self.sieve[x])
            x //= self.sieve[x]
        tmp.append(self.sieve[x])
        return tmp
        
    def is_prime(self,x):
        return self.p[x]
        
    def mobius(self,x):
        return self.mu[x]
        
pf = prime_factorize(100000)

ans = 0
for m in M:
    
    f = pf.factors(m)
    c = Counter(f)
    for v in c.values():
        ans ^= (v%3)
if ans:
    print('Alice')
else:
    print('Bob')
    
0