結果

問題 No.1665 quotient replace
ユーザー mkawa2mkawa2
提出日時 2021-09-03 21:57:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 748 ms / 3,000 ms
コード長 1,693 bytes
コンパイル時間 441 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 251,304 KB
最終ジャッジ日時 2024-05-09 03:46:29
合計ジャッジ時間 13,681 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
74,368 KB
testcase_01 AC 64 ms
74,048 KB
testcase_02 AC 66 ms
74,240 KB
testcase_03 AC 71 ms
77,440 KB
testcase_04 AC 76 ms
79,488 KB
testcase_05 AC 66 ms
75,008 KB
testcase_06 AC 87 ms
88,520 KB
testcase_07 AC 85 ms
82,944 KB
testcase_08 AC 86 ms
87,168 KB
testcase_09 AC 107 ms
90,828 KB
testcase_10 AC 319 ms
134,480 KB
testcase_11 AC 512 ms
177,480 KB
testcase_12 AC 143 ms
100,352 KB
testcase_13 AC 709 ms
251,184 KB
testcase_14 AC 679 ms
250,928 KB
testcase_15 AC 719 ms
251,304 KB
testcase_16 AC 748 ms
251,192 KB
testcase_17 AC 714 ms
250,924 KB
testcase_18 AC 64 ms
74,112 KB
testcase_19 AC 68 ms
73,984 KB
testcase_20 AC 64 ms
74,112 KB
testcase_21 AC 66 ms
73,984 KB
testcase_22 AC 63 ms
74,232 KB
testcase_23 AC 64 ms
73,856 KB
testcase_24 AC 66 ms
74,368 KB
testcase_25 AC 64 ms
74,368 KB
testcase_26 AC 75 ms
80,512 KB
testcase_27 AC 80 ms
88,528 KB
testcase_28 AC 90 ms
91,776 KB
testcase_29 AC 110 ms
97,472 KB
testcase_30 AC 303 ms
171,692 KB
testcase_31 AC 402 ms
190,304 KB
testcase_32 AC 547 ms
175,532 KB
testcase_33 AC 281 ms
119,572 KB
testcase_34 AC 455 ms
187,420 KB
testcase_35 AC 441 ms
173,640 KB
testcase_36 AC 439 ms
185,076 KB
testcase_37 AC 432 ms
172,472 KB
testcase_38 AC 468 ms
199,972 KB
testcase_39 AC 366 ms
155,764 KB
testcase_40 AC 364 ms
155,808 KB
testcase_41 AC 365 ms
156,040 KB
testcase_42 AC 65 ms
74,496 KB
testcase_43 AC 65 ms
74,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**20
# md = 998244353
md = 10**9+7

class Sieve:
    def __init__(self, n):
        self.plist = [2]  # n以下の素数のリスト
        min_prime_factor = [2, 0]*(n//2+1)
        for x in range(3, n+1, 2):
            if min_prime_factor[x] == 0:
                min_prime_factor[x] = x
                self.plist.append(x)
                if x**2 > n: continue
                for y in range(x**2, n+1, 2*x):
                    if min_prime_factor[y] == 0:
                        min_prime_factor[y] = x
        self.min_prime_factor = min_prime_factor

    def isprime(self, x):
        return self.min_prime_factor[x] == x

    # これが素因数分解(prime factorization)
    def pfct(self, x):
        pp, ee = [], []
        while x > 1:
            mpf = self.min_prime_factor[x]
            if pp and mpf == pp[-1]:
                ee[-1] += 1
            else:
                pp.append(mpf)
                ee.append(1)
            x //= mpf
        return ee

mx = 1000005
n = II()
aa = LI()
sv = Sieve(mx)

win = 0
for a in aa:
    win ^= sum(sv.pfct(a))

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