結果
| 問題 | No.1665 quotient replace |
| コンテスト | |
| ユーザー |
hir355
|
| 提出日時 | 2021-09-03 21:31:44 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 531 ms / 3,000 ms |
| コード長 | 1,141 bytes |
| 記録 | |
| コンパイル時間 | 276 ms |
| コンパイル使用メモリ | 82,532 KB |
| 実行使用メモリ | 254,344 KB |
| 最終ジャッジ日時 | 2024-12-15 10:19:11 |
| 合計ジャッジ時間 | 10,970 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
class osa_k:
min_factor = []
def __init__(self, n):
self.min_factor = list(range(n + 1))
i = 2
while i * i <= n:
if self.min_factor[i] < i:
i += 1
continue
for j in range(i*i, n + 1, i):
if self.min_factor[j] == j:
self.min_factor[j] = i
i += 1
def factor(self, n):
res = []
while n > 1:
res.append(self.min_factor[n])
n //= self.min_factor[n]
return len(res)
def divisors(self, n):
res = [1]
while n > 1:
x = self.min_factor[n]
cnt = 0
while n % x == 0:
cnt += 1
n //= x
t = []
p = 1
for i in range(cnt + 1):
for j in range(len(res)):
t.append(res[j] * p)
p *= x
res = t[:]
return res
n = int(input())
a = list(map(int, input().split()))
os = osa_k(1000000)
g = 0
for x in a:
g ^= os.factor(x)
if g == 0:
print('black')
else:
print('white')
hir355