結果

問題 No.1665 quotient replace
ユーザー rlangevinrlangevin
提出日時 2023-02-17 08:55:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 464 ms / 3,000 ms
コード長 597 bytes
コンパイル時間 1,036 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 274,256 KB
最終ジャッジ日時 2023-09-26 10:34:14
合計ジャッジ時間 13,832 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
71,216 KB
testcase_01 AC 77 ms
71,312 KB
testcase_02 AC 76 ms
71,368 KB
testcase_03 AC 187 ms
103,516 KB
testcase_04 AC 193 ms
103,680 KB
testcase_05 AC 162 ms
103,192 KB
testcase_06 AC 198 ms
103,764 KB
testcase_07 AC 167 ms
103,692 KB
testcase_08 AC 169 ms
103,824 KB
testcase_09 AC 167 ms
106,180 KB
testcase_10 AC 251 ms
149,080 KB
testcase_11 AC 332 ms
199,252 KB
testcase_12 AC 195 ms
116,116 KB
testcase_13 AC 464 ms
274,080 KB
testcase_14 AC 449 ms
274,152 KB
testcase_15 AC 408 ms
274,256 KB
testcase_16 AC 400 ms
272,980 KB
testcase_17 AC 408 ms
273,240 KB
testcase_18 AC 120 ms
92,160 KB
testcase_19 AC 104 ms
85,092 KB
testcase_20 AC 127 ms
93,212 KB
testcase_21 AC 131 ms
94,620 KB
testcase_22 AC 114 ms
86,976 KB
testcase_23 AC 141 ms
98,080 KB
testcase_24 AC 121 ms
92,164 KB
testcase_25 AC 112 ms
86,792 KB
testcase_26 AC 166 ms
103,772 KB
testcase_27 AC 160 ms
103,688 KB
testcase_28 AC 171 ms
106,972 KB
testcase_29 AC 178 ms
113,092 KB
testcase_30 AC 285 ms
189,064 KB
testcase_31 AC 327 ms
217,560 KB
testcase_32 AC 295 ms
189,660 KB
testcase_33 AC 230 ms
134,996 KB
testcase_34 AC 293 ms
205,132 KB
testcase_35 AC 282 ms
191,876 KB
testcase_36 AC 290 ms
203,320 KB
testcase_37 AC 280 ms
189,288 KB
testcase_38 AC 292 ms
206,596 KB
testcase_39 AC 245 ms
166,472 KB
testcase_40 AC 252 ms
166,160 KB
testcase_41 AC 249 ms
166,444 KB
testcase_42 AC 74 ms
71,480 KB
testcase_43 AC 75 ms
71,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt, ceil
def Sieve(n):
    lst = [True] * (n + 1)
    S = set()
    for i in range(2, ceil(sqrt(n)) + 1):
        if lst[i]:
            for j in range(2 * i, n + 1, i):
                lst[j] = False
    for i in range(2, n + 1):
        if lst[i]:
            S.add(i)
    return S

N = int(input())
A = list(map(int, input().split()))
M = max(A)
D = [0] * (M + 1)

for p in Sieve(M):
    now = p
    while now <= M:
        for i in range(now, M + 1, now):
            D[i] += 1
        now *= p

ans = 0
for a in A:
    ans ^= D[a]

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