結果

問題 No.1946 ロッカーの問題
ユーザー 👑 platinumplatinum
提出日時 2022-04-13 09:13:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,128 ms / 3,000 ms
コード長 399 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 110,568 KB
最終ジャッジ日時 2023-08-24 19:07:26
合計ジャッジ時間 6,745 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,208 KB
testcase_01 AC 70 ms
71,160 KB
testcase_02 AC 77 ms
78,628 KB
testcase_03 AC 948 ms
110,568 KB
testcase_04 AC 77 ms
78,616 KB
testcase_05 AC 96 ms
78,796 KB
testcase_06 AC 100 ms
78,908 KB
testcase_07 AC 95 ms
78,168 KB
testcase_08 AC 257 ms
86,432 KB
testcase_09 AC 818 ms
106,156 KB
testcase_10 AC 666 ms
102,416 KB
testcase_11 AC 91 ms
76,296 KB
testcase_12 AC 182 ms
78,608 KB
testcase_13 AC 71 ms
70,976 KB
testcase_14 AC 71 ms
71,052 KB
testcase_15 AC 75 ms
75,788 KB
testcase_16 AC 70 ms
71,072 KB
testcase_17 AC 474 ms
87,140 KB
testcase_18 AC 1,128 ms
100,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

B = [0] * (N + 1)
for l in A:
    B[l] = 1

ans = 0
L = [0] * (N + 1)
for i in range(N, 0, -1):
    if L[i] == B[i]:
        ans += 1
    else:
        j = 1
        while j * j <= i:
            if i % j == 0:
                L[j] ^= 1
                if j * j != i:
                    L[i//j] ^= 1
            j += 1

print(ans)
0