結果

問題 No.1665 quotient replace
ユーザー shiroha_F14
提出日時 2021-08-11 20:40:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,496 ms / 3,000 ms
コード長 481 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 119,604 KB
最終ジャッジ日時 2024-12-15 08:52:01
合計ジャッジ時間 64,835 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

# Python (not PyPy) speed test

spf = [0 for i in range(1000001)]
pr = []
for i in range(2, 1000001):
    if spf[i] == 0:
        spf[i] = i
        pr.append(i)
    j = 0
    while j < len(pr) and pr[j] <= spf[i] and i * pr[j] <= 1000000:
        spf[i * pr[j]] = pr[j]
        j += 1

n = int(input())
a = list(map(int, input().split()))
fold = 0
for v in a:
    cnt = 0
    while v > 1:
        v //= spf[v]
        cnt += 1
    fold ^= cnt

print("white" if fold else "black")
0