結果

問題 No.1665 quotient replace
コンテスト
ユーザー tktk_snsn
提出日時 2021-09-03 22:03:02
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 604 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 49 ms
コンパイル使用メモリ 14,592 KB
実行使用メモリ 124,632 KB
最終ジャッジ日時 2026-10-15 23:36:48
合計ジャッジ時間 31,402 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

U = 10 ** 6


def prime_sieve(N):
    #sieve[i] : iの最小の素因数
    sieve = [0] * (N + 1)
    prime = []
    for i in range(2, N + 1):
        if sieve[i] == 0:
            sieve[i] = i
            prime.append(i)
        for p in prime:
            if p > sieve[i] or i * p > N:
                break
            sieve[i * p] = p
    return sieve


sieve = prime_sieve(U + 5)
N = int(input())
A = list(map(int, input().split()))

xor = 0
for a in A:
    cnt = 0
    while sieve[a] != 0:
        cnt += 1
        a //= sieve[a]
    xor ^= cnt

if xor:
    print("white")
else:
    print("black")
0