結果
問題 | No.1665 quotient replace |
ユーザー | satama6 |
提出日時 | 2022-10-19 00:09:39 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,438 bytes |
コンパイル時間 | 1,068 ms |
コンパイル使用メモリ | 86,300 KB |
実行使用メモリ | 258,316 KB |
最終ジャッジ日時 | 2023-09-11 15:54:06 |
合計ジャッジ時間 | 16,276 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 100 ms
83,748 KB |
testcase_01 | AC | 102 ms
83,772 KB |
testcase_02 | AC | 97 ms
83,788 KB |
testcase_03 | AC | 100 ms
84,200 KB |
testcase_04 | AC | 104 ms
84,012 KB |
testcase_05 | AC | 111 ms
83,824 KB |
testcase_06 | AC | 145 ms
85,204 KB |
testcase_07 | AC | 142 ms
84,400 KB |
testcase_08 | AC | 110 ms
84,924 KB |
testcase_09 | AC | 120 ms
87,520 KB |
testcase_10 | AC | 314 ms
132,688 KB |
testcase_11 | AC | 685 ms
181,620 KB |
testcase_12 | AC | 221 ms
96,296 KB |
testcase_13 | AC | 802 ms
257,108 KB |
testcase_14 | AC | 739 ms
257,688 KB |
testcase_15 | AC | 676 ms
258,316 KB |
testcase_16 | AC | 662 ms
257,716 KB |
testcase_17 | AC | 658 ms
257,888 KB |
testcase_18 | AC | 98 ms
83,728 KB |
testcase_19 | AC | 98 ms
84,072 KB |
testcase_20 | AC | 98 ms
83,944 KB |
testcase_21 | AC | 102 ms
83,704 KB |
testcase_22 | AC | 98 ms
83,868 KB |
testcase_23 | AC | 98 ms
83,700 KB |
testcase_24 | AC | 98 ms
83,756 KB |
testcase_25 | AC | 97 ms
83,700 KB |
testcase_26 | AC | 103 ms
84,328 KB |
testcase_27 | AC | 102 ms
84,388 KB |
testcase_28 | AC | 115 ms
87,984 KB |
testcase_29 | AC | 127 ms
93,772 KB |
testcase_30 | AC | 294 ms
169,452 KB |
testcase_31 | AC | 393 ms
201,980 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | AC | 97 ms
83,712 KB |
testcase_43 | AC | 99 ms
83,944 KB |
ソースコード
class FastFactorization: """ 1 ~ Nの整数を全て素因数分解する O(N√N) -> O(NlogN) Parameters ----------- N : int 操作対象の上限値 Notes ----------- 前処理にO(NloglogN), クエリでO(logN) """ def __init__(self, N): self.N = N self.min_factor = [0] * (N+1) self.__Eratosthenes() def __Eratosthenes(self): """ 前処理, O(NloglogN) """ self.min_factor[1] = 1 for p in range(2, self.N+1): if self.min_factor[p] : continue for q in range(p, self.N+1, p): self.min_factor[q] = p # 高速素因数分解 def factorize(self, n): """ 素因数分解を行う,O(logN) Parameters ----------- n : int 操作対象 Returns ----------- res : list(tuple[int, int]) 素因数,冪数を返す。 """ res = 1 while n > 1: p = self.min_factor[n] power = 1 while n % p == 0: n //= p power += 1 res *= power return res-1 N = int(input()) A = list(map(int, input().split())) ff = FastFactorization(1000000) grundy = 0 for a in A: grundy ^= ff.factorize(a) if grundy == 0: print('black') else: print('white')