結果

問題 No.1946 ロッカーの問題
ユーザー stngstng
提出日時 2022-05-21 16:21:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 978 ms / 3,000 ms
コード長 561 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 81,536 KB
実行使用メモリ 97,228 KB
最終ジャッジ日時 2023-10-20 16:20:51
合計ジャッジ時間 5,293 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,516 KB
testcase_01 AC 32 ms
53,516 KB
testcase_02 AC 39 ms
62,360 KB
testcase_03 AC 772 ms
97,228 KB
testcase_04 AC 38 ms
62,364 KB
testcase_05 AC 60 ms
70,972 KB
testcase_06 AC 64 ms
73,308 KB
testcase_07 AC 59 ms
70,684 KB
testcase_08 AC 213 ms
82,060 KB
testcase_09 AC 682 ms
94,628 KB
testcase_10 AC 555 ms
92,172 KB
testcase_11 AC 64 ms
72,808 KB
testcase_12 AC 154 ms
77,820 KB
testcase_13 AC 33 ms
53,304 KB
testcase_14 AC 32 ms
53,304 KB
testcase_15 AC 37 ms
59,764 KB
testcase_16 AC 32 ms
53,516 KB
testcase_17 AC 391 ms
82,656 KB
testcase_18 AC 978 ms
91,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


n,m = map(int,input().split())
a = [int(i) for i in input().split()]

A = [0]*(n+1)
for i in range(m):
    A[a[i]] = 1

#print(A)
li = [0]*(n+1)
ans = 0

for i in range(n,0,-1):
    if A[i] != li[i]:
        for j in make_divisors(i):
            li[j] += 1
            li[j] %= 2
    else:
        ans += 1

print(ans)
0