結果

問題 No.1665 quotient replace
ユーザー mkawa2mkawa2
提出日時 2021-09-03 21:57:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 840 ms / 3,000 ms
コード長 1,693 bytes
コンパイル時間 511 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 256,280 KB
最終ジャッジ日時 2023-08-21 21:38:49
合計ジャッジ時間 17,215 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
88,428 KB
testcase_01 AC 97 ms
88,412 KB
testcase_02 AC 98 ms
88,508 KB
testcase_03 AC 105 ms
88,516 KB
testcase_04 AC 109 ms
88,728 KB
testcase_05 AC 103 ms
88,436 KB
testcase_06 AC 150 ms
89,564 KB
testcase_07 AC 112 ms
89,340 KB
testcase_08 AC 121 ms
89,516 KB
testcase_09 AC 139 ms
92,036 KB
testcase_10 AC 363 ms
139,504 KB
testcase_11 AC 666 ms
187,480 KB
testcase_12 AC 178 ms
100,672 KB
testcase_13 AC 823 ms
256,156 KB
testcase_14 AC 835 ms
256,148 KB
testcase_15 AC 830 ms
255,616 KB
testcase_16 AC 840 ms
256,280 KB
testcase_17 AC 813 ms
255,772 KB
testcase_18 AC 96 ms
88,356 KB
testcase_19 AC 96 ms
88,452 KB
testcase_20 AC 98 ms
88,396 KB
testcase_21 AC 98 ms
88,176 KB
testcase_22 AC 98 ms
88,364 KB
testcase_23 AC 98 ms
88,352 KB
testcase_24 AC 98 ms
88,356 KB
testcase_25 AC 98 ms
88,392 KB
testcase_26 AC 107 ms
89,408 KB
testcase_27 AC 111 ms
89,468 KB
testcase_28 AC 124 ms
92,240 KB
testcase_29 AC 141 ms
98,092 KB
testcase_30 AC 348 ms
175,852 KB
testcase_31 AC 476 ms
201,576 KB
testcase_32 AC 635 ms
180,924 KB
testcase_33 AC 316 ms
120,196 KB
testcase_34 AC 517 ms
186,968 KB
testcase_35 AC 496 ms
177,264 KB
testcase_36 AC 522 ms
188,820 KB
testcase_37 AC 476 ms
175,464 KB
testcase_38 AC 550 ms
198,748 KB
testcase_39 AC 432 ms
159,800 KB
testcase_40 AC 426 ms
159,824 KB
testcase_41 AC 420 ms
159,700 KB
testcase_42 AC 96 ms
88,396 KB
testcase_43 AC 95 ms
88,512 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