結果

問題 No.1946 ロッカーの問題
ユーザー rlangevinrlangevin
提出日時 2022-12-30 22:59:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,215 ms / 3,000 ms
コード長 447 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 110,752 KB
最終ジャッジ日時 2023-08-17 03:51:50
合計ジャッジ時間 8,041 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,256 KB
testcase_01 AC 71 ms
71,388 KB
testcase_02 AC 77 ms
78,644 KB
testcase_03 AC 978 ms
110,752 KB
testcase_04 AC 77 ms
78,856 KB
testcase_05 AC 101 ms
79,028 KB
testcase_06 AC 106 ms
79,252 KB
testcase_07 AC 98 ms
78,752 KB
testcase_08 AC 279 ms
86,928 KB
testcase_09 AC 850 ms
106,584 KB
testcase_10 AC 714 ms
102,960 KB
testcase_11 AC 97 ms
76,932 KB
testcase_12 AC 200 ms
79,676 KB
testcase_13 AC 72 ms
71,252 KB
testcase_14 AC 72 ms
71,096 KB
testcase_15 AC 74 ms
76,016 KB
testcase_16 AC 72 ms
71,420 KB
testcase_17 AC 502 ms
87,544 KB
testcase_18 AC 1,215 ms
100,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def div(n):
    S = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            S.add(i)
            S.add(n // i)
        i += 1
    return S

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

D = [0] * (N + 1)
for a in A:
    D[a] += 1
    
ans = 0
E = [0] * (N + 1)
for i in range(N, 0, -1):
    if D[i] == E[i]:
        ans += 1
    else:
        for d in div(i):
            E[d] = 1 - E[d]
print(ans)        
0