結果

問題 No.1972 Modulo Set
ユーザー june19312
提出日時 2022-06-13 17:04:31
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 521 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 107,776 KB
最終ジャッジ日時 2024-09-25 11:23:03
合計ジャッジ時間 8,758 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dict = {}

for i,v in enumerate(A):
    tmp =v%M
    if tmp not in dict:
        dict[tmp] = 1
    else:
        dict[tmp]+=1

tmp = []

for i,v in dict.items():
    tmp.append([v,i])

tmp.sort()
tmp.reverse()

#print(tmp)

ans = 0
#print(dict)
for i,v in enumerate(tmp):
    a,b = v[0],v[1]

    if b*2 == M:
        ans+=1
    else:
        #print("a=",a,"b=",b)
        #print("dict[b]",dict[b])
        ans+=dict[b]
        dict[M-b] = 0

print(ans)
0