結果

問題 No.1946 ロッカーの問題
ユーザー ああいいああいい
提出日時 2022-05-20 21:46:32
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 703 ms / 3,000 ms
コード長 430 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 81,636 KB
実行使用メモリ 141,900 KB
最終ジャッジ日時 2023-10-20 12:15:13
合計ジャッジ時間 6,933 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,448 KB
testcase_01 AC 39 ms
53,448 KB
testcase_02 AC 640 ms
128,408 KB
testcase_03 AC 703 ms
141,900 KB
testcase_04 AC 605 ms
128,408 KB
testcase_05 AC 396 ms
105,632 KB
testcase_06 AC 497 ms
120,276 KB
testcase_07 AC 326 ms
104,364 KB
testcase_08 AC 163 ms
102,600 KB
testcase_09 AC 607 ms
136,256 KB
testcase_10 AC 535 ms
128,952 KB
testcase_11 AC 62 ms
68,592 KB
testcase_12 AC 174 ms
89,648 KB
testcase_13 AC 37 ms
53,448 KB
testcase_14 AC 38 ms
53,448 KB
testcase_15 AC 54 ms
66,644 KB
testcase_16 AC 38 ms
53,448 KB
testcase_17 AC 242 ms
104,516 KB
testcase_18 AC 678 ms
136,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = list(map(int,input().split()))
s = set(A)

dat = [0] * (N + 1)
div = [[] for _ in range(N + 1)]
for i in range(1,N + 1):
    for j in range(i,N + 1,i):
        div[j].append(i)
ans = 0
for i in range(N,0,-1):
    if dat[i] == 0 and i not in s:
        ans += 1
        continue
    if dat[i] == 1 and i in s:
        ans += 1
        continue
    for j in div[i]:
        dat[j] ^= 1
print(ans)
0