結果

問題 No.1946 ロッカーの問題
ユーザー tnodinotnodino
提出日時 2022-05-21 19:14:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 951 ms / 3,000 ms
コード長 514 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 109,612 KB
最終ジャッジ日時 2023-10-20 16:33:29
合計ジャッジ時間 5,449 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,712 KB
testcase_01 AC 37 ms
53,712 KB
testcase_02 AC 43 ms
62,744 KB
testcase_03 AC 779 ms
109,612 KB
testcase_04 AC 43 ms
62,808 KB
testcase_05 AC 66 ms
71,288 KB
testcase_06 AC 68 ms
71,576 KB
testcase_07 AC 62 ms
71,000 KB
testcase_08 AC 212 ms
85,544 KB
testcase_09 AC 669 ms
105,504 KB
testcase_10 AC 579 ms
101,720 KB
testcase_11 AC 67 ms
71,080 KB
testcase_12 AC 149 ms
78,428 KB
testcase_13 AC 36 ms
53,712 KB
testcase_14 AC 37 ms
53,648 KB
testcase_15 AC 43 ms
60,008 KB
testcase_16 AC 37 ms
53,712 KB
testcase_17 AC 387 ms
86,140 KB
testcase_18 AC 951 ms
99,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
def Divisor(N):
    ret = []
    for i in range(1,int(sqrt(N))+1):
        if N % i == 0:
            ret.append(i)
            if N // i != i:
                ret.append(N//i)
    return ret

N,M = map(int,input().split())
A = list(map(int,input().split()))
Locker = [0] * (N+1)
for a in A:
    Locker[a] = 1
Flg = [0] * (N+1)
ans = 0
for i in range(N,0,-1):
    if Flg[i] == Locker[i]:
        ans += 1
    else:
        P = Divisor(i)
        for p in P:
            Flg[p] ^= 1
print(ans)
0