結果

問題 No.1972 Modulo Set
ユーザー taiga0629kyopro
提出日時 2022-06-12 12:14:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 342 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 127,008 KB
最終ジャッジ日時 2024-09-22 22:28:15
合計ジャッジ時間 4,990 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

from _collections import defaultdict
n,m=map(int,input().split())
s=set()
a=list(map(int,input().split()))
for i in range(n):a[i]%=m
cnt=defaultdict(int)

ans=0
nod=set()

for x in a:
    cnt[x]+=1
for x in cnt:
    nod.add(x)
    nod.add((m-x)%m)

for x in nod:
    y=(m-x)%m
    if y<x:continue
    ans+=max(cnt[x],cnt[y])
print(ans)





0