結果

問題 No.1946 ロッカーの問題
ユーザー pitPpitP
提出日時 2022-05-20 22:09:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 970 ms / 3,000 ms
コード長 358 bytes
コンパイル時間 1,187 ms
コンパイル使用メモリ 11,888 KB
実行使用メモリ 31,760 KB
最終ジャッジ日時 2023-10-20 12:50:52
合計ジャッジ時間 9,678 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,000 KB
testcase_01 AC 27 ms
10,000 KB
testcase_02 AC 907 ms
13,024 KB
testcase_03 AC 953 ms
31,760 KB
testcase_04 AC 882 ms
13,024 KB
testcase_05 AC 689 ms
12,232 KB
testcase_06 AC 739 ms
12,496 KB
testcase_07 AC 563 ms
11,968 KB
testcase_08 AC 319 ms
17,544 KB
testcase_09 AC 855 ms
31,592 KB
testcase_10 AC 739 ms
27,584 KB
testcase_11 AC 55 ms
10,480 KB
testcase_12 AC 381 ms
13,600 KB
testcase_13 AC 27 ms
10,000 KB
testcase_14 AC 29 ms
10,000 KB
testcase_15 AC 99 ms
10,152 KB
testcase_16 AC 28 ms
10,000 KB
testcase_17 AC 460 ms
17,520 KB
testcase_18 AC 970 ms
25,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
a = list(map(int,input().split()))
g = [0] * (n+1)
for i in range(m):
    g[a[i]] = 1

boo = [1] * (n+1) #サボったら0

ans = 0
for i in range(n,0,-1):
    coef = 1
    cnt = 0
    while i * coef <= n:
        cnt += boo[i * coef]
        coef += 1
    
    if cnt%2 != g[i]:
        boo[i] = 0
        ans += 1

print(ans)
0