結果

問題 No.1946 ロッカーの問題
ユーザー 👑 rin204
提出日時 2022-05-20 21:39:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 974 ms / 3,000 ms
コード長 382 bytes
コンパイル時間 177 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 108,288 KB
最終ジャッジ日時 2024-09-20 07:35:33
合計ジャッジ時間 5,310 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
A = list(map(int, input().split()))
open = [False] * (n + 1)
for a in A:
    open[a] = True
ans = 0

for i in range(n, 0, -1):
    if not open[i]:
        ans += 1
        continue
    for j in range(1, int(i ** 0.5 + 1)):
        if i % j == 0:
            open[j] ^= True
            if j * j != i:
                open[i // j] ^= True
print(ans)
0