結果

問題 No.1946 ロッカーの問題
ユーザー june19312june19312
提出日時 2022-05-20 23:39:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 527 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 109,004 KB
最終ジャッジ日時 2023-10-20 14:35:07
合計ジャッジ時間 2,592 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,524 KB
testcase_01 AC 38 ms
53,524 KB
testcase_02 AC 36 ms
53,524 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 36 ms
53,524 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if M == 0:
    print(N)
    exit()

A = list(map(int,input().split()))
B = [False]*(N+1)

for i,v in enumerate(A):
    if v:
        B[v] = True

ans = [1]*(N+1)

if N%2 == 0:
    tmp = N//2
else:
    tmp = N//2+1

for i in range(tmp,N+1):
    if not B[i]:
        ans[i] = 0

#print(ans)

for i in range(tmp,0,-1):
    tmp2 = N//i
    cnt = 0

    for j in range(tmp2):
        if ans[i*(j+1)] == 1:
            cnt+=1

    if tmp2%2 == 0 and B[i]:
        ans[i] = 0

print(sum(ans))
        
0