結果
| 問題 |
No.1665 quotient replace
|
| コンテスト | |
| ユーザー |
donuthole
|
| 提出日時 | 2021-09-03 23:14:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,824 bytes |
| コンパイル時間 | 456 ms |
| コンパイル使用メモリ | 82,372 KB |
| 実行使用メモリ | 240,504 KB |
| 最終ジャッジ日時 | 2024-12-15 17:38:59 |
| 合計ジャッジ時間 | 9,919 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 27 |
ソースコード
# region template
import typing
import sys
import math
import collections
import bisect
import itertools
import heapq
import copy
def ni(): return int(sys.stdin.buffer.readline())
def ns(): return map(int, sys.stdin.buffer.readline().split())
def ns1(): return map(lambda x: int(x)-1, sys.stdin.buffer.readline().split())
def na(): return list(map(int, sys.stdin.buffer.readline().split()))
def na1(): return list(map(lambda x: int(x)-1, sys.stdin.buffer.readline().split()))
def nall(): return list(map(int, sys.stdin.buffer.read().split()))
def flush(): return sys.stdout.flush()
def nic(): return int(sys.stdin.readline())
def nsc(): return map(int, sys.stdin.readline().split())
def nac(): return list(map(int, sys.stdin.readline().split()))
def na1c(): return list(map(lambda x: int(x)-1, sys.stdin.readline().split()))
# endregion
# sys.setrecursionlimit(10**7+1)
inf = 10**20
mod = 10**9+7
# mod = 998244353
def Eratosthenes(n): # N以下のすべての値の素数判定 O(NloglogN)、N=10^7のとき4*10^7くらい
a = [True]*(n + 1)
a[0], a[1] = False, False
if n >= 2:
for i in range(2, n + 1):
if a[i]:
for j in range(i+i, n + 1, i):
a[j] = False
# a = [i for i in range(n+1) if a[i]]
return a
def main():
n = ni()
a = na()
lim = max(a)
kushi = Eratosthenes(lim)
base = 0
over = 0
for ai in a:
if kushi[ai]:
base += 1
elif ai != 1:
over += 1
res = 0
# 0:white win, 1:black win
b = base % 2
o = over % 2
if o:
if b:
res = 1
else:
res = 0
else:
if b:
res = 1
else:
res = 0
print('white' if res^1 else 'black')
if __name__ == '__main__':
main()
donuthole