結果

問題 No.1946 ロッカーの問題
ユーザー Akijin_007Akijin_007
提出日時 2022-05-20 23:06:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,157 ms / 3,000 ms
コード長 515 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 81,716 KB
実行使用メモリ 107,420 KB
最終ジャッジ日時 2023-10-20 13:59:56
合計ジャッジ時間 6,001 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,456 KB
testcase_01 AC 39 ms
53,456 KB
testcase_02 AC 43 ms
58,948 KB
testcase_03 AC 916 ms
107,420 KB
testcase_04 AC 43 ms
58,948 KB
testcase_05 AC 64 ms
63,516 KB
testcase_06 AC 67 ms
63,660 KB
testcase_07 AC 61 ms
63,372 KB
testcase_08 AC 231 ms
81,984 KB
testcase_09 AC 805 ms
103,752 KB
testcase_10 AC 650 ms
99,916 KB
testcase_11 AC 62 ms
64,428 KB
testcase_12 AC 152 ms
70,120 KB
testcase_13 AC 37 ms
53,456 KB
testcase_14 AC 37 ms
53,456 KB
testcase_15 AC 41 ms
59,592 KB
testcase_16 AC 38 ms
53,456 KB
testcase_17 AC 447 ms
82,296 KB
testcase_18 AC 1,157 ms
97,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

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

r = [0] * (N+1)
for i in range(M):
    r[A[i]] = 1

ans = 0
for i in range(N, 0, -1):
    if r[i] == 0:
        ans += 1
        continue
    for j in range(1, i):
        if j ** 2 > i:
            break
        elif i % j != 0:
            continue
        if j ** 2 == i:
            r[j] ^= 1
        else:
            r[j] ^= 1
            r[i//j] ^= 1

print(ans)
0