結果

問題 No.1665 quotient replace
ユーザー kohei2019kohei2019
提出日時 2023-08-12 16:21:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 619 ms / 3,000 ms
コード長 992 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 82,360 KB
実行使用メモリ 273,028 KB
最終ジャッジ日時 2024-04-30 11:16:26
合計ジャッジ時間 20,945 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,760 KB
testcase_01 AC 41 ms
53,140 KB
testcase_02 AC 39 ms
53,756 KB
testcase_03 AC 401 ms
111,564 KB
testcase_04 AC 400 ms
111,392 KB
testcase_05 AC 407 ms
111,540 KB
testcase_06 AC 409 ms
112,188 KB
testcase_07 AC 412 ms
111,896 KB
testcase_08 AC 408 ms
111,844 KB
testcase_09 AC 411 ms
114,560 KB
testcase_10 AC 481 ms
158,172 KB
testcase_11 AC 543 ms
199,516 KB
testcase_12 AC 421 ms
124,076 KB
testcase_13 AC 619 ms
272,884 KB
testcase_14 AC 610 ms
272,960 KB
testcase_15 AC 601 ms
272,956 KB
testcase_16 AC 604 ms
272,648 KB
testcase_17 AC 607 ms
273,028 KB
testcase_18 AC 236 ms
96,548 KB
testcase_19 AC 153 ms
87,728 KB
testcase_20 AC 258 ms
97,976 KB
testcase_21 AC 270 ms
99,804 KB
testcase_22 AC 180 ms
89,276 KB
testcase_23 AC 324 ms
104,384 KB
testcase_24 AC 232 ms
96,136 KB
testcase_25 AC 178 ms
89,376 KB
testcase_26 AC 397 ms
111,992 KB
testcase_27 AC 399 ms
112,068 KB
testcase_28 AC 409 ms
115,208 KB
testcase_29 AC 417 ms
121,112 KB
testcase_30 AC 503 ms
193,960 KB
testcase_31 AC 535 ms
213,556 KB
testcase_32 AC 538 ms
198,448 KB
testcase_33 AC 462 ms
142,388 KB
testcase_34 AC 524 ms
210,556 KB
testcase_35 AC 516 ms
196,476 KB
testcase_36 AC 533 ms
208,584 KB
testcase_37 AC 510 ms
195,120 KB
testcase_38 AC 531 ms
223,564 KB
testcase_39 AC 491 ms
179,296 KB
testcase_40 AC 500 ms
179,216 KB
testcase_41 AC 496 ms
179,376 KB
testcase_42 AC 38 ms
52,264 KB
testcase_43 AC 37 ms
52,248 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def primeset(N): #N以下の素数をsetで求める.エラトステネスの篩O(√Nlog(N))
    lsx = [1]*(N+1)
    for i in range(2,int(-(-N**0.5//1))+1):
        if lsx[i] == 1:
            for j in range(i,N//i+1):
                lsx[j*i] = 0
    setprime = set()
    for i in range(2,N+1):
        if lsx[i] == 1:
            setprime.add(i)
    return setprime

def factorization_all_c(n):#n以下の自然数すべてをを素因数分解,素因数の数をカウント
    lspn = [0 for i in range(n+1)]
    lsnum = [i for i in range(n+1)]
    lsp = list(primeset(n))
    lsp.sort()
    for p in lsp:
        for j in range(1,n//p+1):
            cnt = 0
            while lsnum[p*j]%p==0:
                lsnum[p*j] //= p
                cnt += 1
            lspn[j*p]+=cnt
    return lspn

N = int(input())
lsA = list(map(int,input().split()))

fa = factorization_all_c(max(lsA))
ans = 0
for i in range(N):
    ans ^= fa[lsA[i]]
if ans:
    print('white')
else:
    print('black')
0