結果

問題 No.1946 ロッカーの問題
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-20 21:54:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 620 ms / 3,000 ms
コード長 333 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 11,896 KB
実行使用メモリ 33,472 KB
最終ジャッジ日時 2023-10-20 12:29:14
合計ジャッジ時間 7,025 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,104 KB
testcase_01 AC 28 ms
10,104 KB
testcase_02 AC 580 ms
11,544 KB
testcase_03 AC 620 ms
33,024 KB
testcase_04 AC 563 ms
11,544 KB
testcase_05 AC 408 ms
11,544 KB
testcase_06 AC 462 ms
11,604 KB
testcase_07 AC 352 ms
11,352 KB
testcase_08 AC 212 ms
17,588 KB
testcase_09 AC 559 ms
33,472 KB
testcase_10 AC 480 ms
27,684 KB
testcase_11 AC 47 ms
10,612 KB
testcase_12 AC 251 ms
14,992 KB
testcase_13 AC 28 ms
10,104 KB
testcase_14 AC 28 ms
10,104 KB
testcase_15 AC 79 ms
10,224 KB
testcase_16 AC 28 ms
10,104 KB
testcase_17 AC 301 ms
17,620 KB
testcase_18 AC 619 ms
25,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
A = list(map(int, input().split()))
S = set(A)

sabo = [0] * (N + 1)
for i in reversed(range(1, N+1)):
    c = (N // i) % 2
    for j in range(i, N+1, i):
        c ^= sabo[j]
    if i in S and c == 1:
        continue
    if not i in S and c == 0:
        continue
    sabo[i] = 1

print(sum(sabo))
0