結果

問題 No.1665 quotient replace
ユーザー kept1994kept1994
提出日時 2021-09-04 01:02:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 754 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 259,880 KB
最終ジャッジ日時 2023-08-22 03:48:39
合計ジャッジ時間 31,414 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
237,836 KB
testcase_01 AC 74 ms
71,312 KB
testcase_02 AC 72 ms
71,600 KB
testcase_03 AC 85 ms
76,072 KB
testcase_04 WA -
testcase_05 AC 76 ms
75,548 KB
testcase_06 AC 121 ms
77,468 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1,208 ms
127,836 KB
testcase_11 AC 2,564 ms
186,956 KB
testcase_12 AC 365 ms
89,524 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 AC 72 ms
71,428 KB
testcase_19 AC 73 ms
71,504 KB
testcase_20 AC 72 ms
71,664 KB
testcase_21 AC 72 ms
71,568 KB
testcase_22 AC 72 ms
71,504 KB
testcase_23 AC 73 ms
71,144 KB
testcase_24 AC 73 ms
71,304 KB
testcase_25 AC 72 ms
71,292 KB
testcase_26 AC 103 ms
76,664 KB
testcase_27 AC 156 ms
76,656 KB
testcase_28 AC 437 ms
80,992 KB
testcase_29 AC 813 ms
86,728 KB
testcase_30 TLE -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys

def main():
    N = int(input())
    A = list(map(int, input().split()))
    dp = [-1] * N   # 0 : white, 1 : black
    dp[0] = 0
    def primeFactrization(n: int) -> list:
        primeFactors = list()
        i = 2
        while i * i <= n:
            while n % i == 0:
                primeFactors.append(i)
                n //= i
            i += 1
        if n != 1:
            primeFactors.append(n)
        return primeFactors
    pf = [len(primeFactrization(aa)) for aa in A]
    for i in range(N - 1):
        if pf[i + 1] % 2 == 0:
            dp[i + 1] = dp[i]
        else:
            dp[i + 1] = dp[i] ^ 1
    print("white" if dp[-1] == 0 else "black")
    return

if __name__ == '__main__':
    main()
0