結果

問題 No.1946 ロッカーの問題
ユーザー abababab
提出日時 2022-05-20 22:37:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 513 bytes
コンパイル時間 939 ms
コンパイル使用メモリ 11,836 KB
実行使用メモリ 46,460 KB
最終ジャッジ日時 2023-10-20 13:23:00
合計ジャッジ時間 5,335 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def div_lis(x):
    div_l, div_r = [], []
    i = 1
    while i * i <= x:
        if x % i == 0:
            div_l.append(i)
            if i != x // i:
                div_r.append(x // i)
        i += 1
    div = div_l + div_r[::-1]
    return div


n, m = map(int, input().split())
A = set(map(int, input().split()))

open_ = [0] * (n + 1)
ans = 0
for x in reversed(range(1, n + 1)):
    if (x in A) != open_[x]:
        for div in div_lis(x):
            open_[div] ^= 1
    else:
        ans += 1

print(ans)
0