結果

問題 No.1946 ロッカーの問題
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-05-20 22:02:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,180 ms / 3,000 ms
コード長 420 bytes
コンパイル時間 881 ms
コンパイル使用メモリ 81,564 KB
実行使用メモリ 125,284 KB
最終ジャッジ日時 2023-10-20 12:41:47
合計ジャッジ時間 6,248 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,468 KB
testcase_01 AC 39 ms
53,468 KB
testcase_02 AC 43 ms
61,104 KB
testcase_03 AC 956 ms
125,284 KB
testcase_04 AC 44 ms
61,240 KB
testcase_05 AC 73 ms
71,712 KB
testcase_06 AC 76 ms
71,856 KB
testcase_07 AC 71 ms
71,568 KB
testcase_08 AC 257 ms
90,636 KB
testcase_09 AC 822 ms
119,768 KB
testcase_10 AC 695 ms
112,604 KB
testcase_11 AC 71 ms
73,376 KB
testcase_12 AC 179 ms
79,016 KB
testcase_13 AC 37 ms
53,472 KB
testcase_14 AC 37 ms
53,472 KB
testcase_15 AC 42 ms
59,836 KB
testcase_16 AC 38 ms
53,472 KB
testcase_17 AC 475 ms
90,968 KB
testcase_18 AC 1,180 ms
109,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
a = set(map(int,input().split()))
def cul(k):
    cnt = 1
    res = set()
    while cnt ** 2 <= k:
        if k%cnt == 0:
            res.add(cnt)
            res.add(k//cnt)
        cnt += 1
    return res
l = [0] * (n+1)
ans = 0
for i in range(n,0,-1):
    val = (1 if i in a else 0)
    if l[i] ^ val:
        for e in cul(i):
            l[e] ^= 1
    else:
        ans += 1
print(ans)
0