結果

問題 No.1946 ロッカーの問題
ユーザー tktk_snsntktk_snsn
提出日時 2022-05-20 21:47:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 1,087 ms
コンパイル使用メモリ 11,924 KB
実行使用メモリ 33,404 KB
最終ジャッジ日時 2023-10-20 12:16:08
合計ジャッジ時間 9,455 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,144 KB
testcase_01 AC 27 ms
10,144 KB
testcase_02 AC 929 ms
11,564 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 29 ms
10,144 KB
testcase_14 AC 29 ms
10,144 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

cnt = [0] * (N + 1)
for i in range(1, N+1):
    for j in range(i, N+1, i):
        cnt[j] ^= 1

ans = 0
for i in range(1, N+1):
    if i in S and cnt[i] == 1:
        continue
    if not i in S and cnt[i] == 0:
        continue
    ans += 1
    for j in range(i, N+1, i):
        cnt[j] ^= 1

print(ans)
0