結果

問題 No.1665 quotient replace
ユーザー tamato
提出日時 2021-09-03 21:39:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 764 ms / 3,000 ms
コード長 808 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 82,752 KB
実行使用メモリ 224,552 KB
最終ジャッジ日時 2024-12-15 11:07:09
合計ジャッジ時間 29,750 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    M = 10 ** 6
    min_factor = list(range(M+1))
    for i in range(2, M+1):
        for x in range(1, M+1):
            if i * x > M:
                break
            if min_factor[i*x] == i*x:
                min_factor[i*x] = i

    G = [0] * (M+1)
    for i in range(2, M+1):
        P = {}
        ii = i
        while ii != 1:
            p = min_factor[ii]
            if p not in P:
                P[p] = 0
            P[p] += 1
            ii //= p
        for p in P:
            G[i] += P[p]
    N = int(input())
    A = list(map(int, input().split()))
    g = 0
    for a in A:
        g ^= G[a]
    if g:
        print("white")
    else:
        print("black")


if __name__ == '__main__':
    main()
0