結果

問題 No.1665 quotient replace
ユーザー AEn
提出日時 2022-09-07 00:45:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,164 ms / 3,000 ms
コード長 522 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 253,360 KB
最終ジャッジ日時 2024-11-22 00:58:56
合計ジャッジ時間 34,641 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

def fac(M):
    if M == 1:
        return 0
    else:
        cnt = 0
        s = 2
        while s*s<=M:
            if M%s==0:
                while M%s==0:
                    M//=s
                    cnt += 1
            s += 1
        if M>1:
            cnt += 1
        return cnt

cal = [-1]*(10**6+1)
res = 0
for i in range(N):
    if cal[A[i]] == -1:
        cal[A[i]] = fac(A[i])
    res ^= cal[A[i]]
if res==0:
    print('black')
else:
    print('white')
0