結果

問題 No.1946 ロッカーの問題
ユーザー tassei903tassei903
提出日時 2022-05-21 09:05:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 3,000 ms
コード長 563 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 81,452 KB
実行使用メモリ 107,412 KB
最終ジャッジ日時 2023-10-20 15:42:00
合計ジャッジ時間 2,271 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,220 KB
testcase_01 AC 38 ms
53,220 KB
testcase_02 AC 70 ms
63,520 KB
testcase_03 AC 123 ms
107,412 KB
testcase_04 AC 70 ms
63,520 KB
testcase_05 AC 70 ms
67,392 KB
testcase_06 AC 71 ms
67,536 KB
testcase_07 AC 69 ms
65,540 KB
testcase_08 AC 66 ms
79,704 KB
testcase_09 AC 109 ms
103,480 KB
testcase_10 AC 101 ms
99,908 KB
testcase_11 AC 49 ms
66,248 KB
testcase_12 AC 63 ms
69,892 KB
testcase_13 AC 34 ms
53,220 KB
testcase_14 AC 33 ms
53,220 KB
testcase_15 AC 43 ms
62,128 KB
testcase_16 AC 32 ms
53,220 KB
testcase_17 AC 65 ms
77,944 KB
testcase_18 AC 94 ms
94,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

n,m = na()
a = na()
f = [0]*(1+n)
for i in range(m):
    f[a[i]] = 1
c = 0
for i in range(n,0,-1):
    for j in range(i*2, n+1, i):
        f[i] ^= f[j]
    if f[i] ^ 1:
        c += 1
    #print(f)

print(c)
0