結果

問題 No.1665 quotient replace
ユーザー 👑 KazunKazun
提出日時 2021-09-03 21:28:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 720 ms / 3,000 ms
コード長 1,101 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 253,616 KB
最終ジャッジ日時 2024-05-09 01:48:25
合計ジャッジ時間 12,750 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,352 KB
testcase_01 AC 38 ms
52,352 KB
testcase_02 AC 37 ms
51,840 KB
testcase_03 AC 72 ms
73,216 KB
testcase_04 AC 73 ms
72,704 KB
testcase_05 AC 61 ms
67,584 KB
testcase_06 AC 99 ms
84,096 KB
testcase_07 AC 78 ms
75,264 KB
testcase_08 AC 78 ms
78,464 KB
testcase_09 AC 101 ms
86,528 KB
testcase_10 AC 295 ms
130,584 KB
testcase_11 AC 513 ms
175,656 KB
testcase_12 AC 134 ms
95,872 KB
testcase_13 AC 700 ms
253,364 KB
testcase_14 AC 703 ms
253,364 KB
testcase_15 AC 677 ms
253,496 KB
testcase_16 AC 679 ms
253,492 KB
testcase_17 AC 720 ms
253,616 KB
testcase_18 AC 54 ms
63,872 KB
testcase_19 AC 52 ms
62,336 KB
testcase_20 AC 56 ms
64,384 KB
testcase_21 AC 56 ms
64,896 KB
testcase_22 AC 54 ms
62,720 KB
testcase_23 AC 59 ms
65,792 KB
testcase_24 AC 55 ms
63,744 KB
testcase_25 AC 53 ms
62,592 KB
testcase_26 AC 74 ms
72,320 KB
testcase_27 AC 79 ms
77,824 KB
testcase_28 AC 90 ms
87,296 KB
testcase_29 AC 103 ms
92,800 KB
testcase_30 AC 279 ms
167,140 KB
testcase_31 AC 368 ms
185,656 KB
testcase_32 AC 495 ms
175,016 KB
testcase_33 AC 247 ms
114,724 KB
testcase_34 AC 446 ms
182,744 KB
testcase_35 AC 409 ms
168,424 KB
testcase_36 AC 434 ms
180,656 KB
testcase_37 AC 393 ms
167,376 KB
testcase_38 AC 469 ms
195,644 KB
testcase_39 AC 344 ms
151,124 KB
testcase_40 AC 348 ms
151,120 KB
testcase_41 AC 356 ms
151,248 KB
testcase_42 AC 40 ms
52,352 KB
testcase_43 AC 39 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def Smallest_Prime_Factor(N):
    """0,1,2,...,Nの最小の素因数のリスト(0,1については1にしている)
    """

    if N==0:
        return [1]

    N=abs(N)
    L=list(range(N+1))
    L[0]=L[1]=1

    x=4
    while x<=N:
        L[x]=2
        x+=2

    x=9
    while x<=N:
        if L[x]==x:
            L[x]=3
        x+=6

    x=5
    Flag=0
    while x*x<=N:
        if L[x]==x:
            y=x*x
            while y<=N:
                if L[y]==y:
                    L[y]=x
                y+=x<<1
        x+=2+2*Flag
        Flag^=1

    return L

def Faster_Prime_Factorization(N,L):
    """

    L:Smallest_Prime_Factors(N)で求めたリスト
    """
    N=abs(N)

    D=[]
    while N>1:
        a=L[N]
        k=0
        while L[N]==a:
            k+=1
            N//=a
        D.append([a,k])
    return D
#==================================================
N=int(input())
A=list(map(int,input().split()))

L=Smallest_Prime_Factor(max(A))

G=0
for a in A:
    X=0
    for p,e in Faster_Prime_Factorization(a,L):
        X+=e
    G^=X

print("white" if G else "black")
0