結果

問題 No.1665 quotient replace
ユーザー brthyyjp
提出日時 2021-09-16 14:27:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 748 ms / 3,000 ms
コード長 613 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 265,624 KB
最終ジャッジ日時 2024-06-29 14:24:02
合計ジャッジ時間 13,852 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = 2*10**6
spf = [-1]*(N+1)
for i in range(N+1):
    spf[i] = i
for i in range(2, int(math.sqrt(N))+1):
    if spf[i] == i:
        for j in range(i*2, N+1, i):
            if spf[j] == j:
                spf[j] = i

def factorize(n):
    d = {}
    while n != 1:
        p = spf[n]
        if p in d:
            d[p] += 1
        else:
            d[p] = 1
        n //= p
    return d

n = int(input())
A = list(map(int, input().split()))
t = 0
for a in A:
    d = factorize(a)
    c = 0
    for k, v in d.items():
        c += v
    t ^= c
if t == 0:
    print('black')
else:
    print('white')
0