結果

問題 No.1972 Modulo Set
ユーザー gr1msl3y
提出日時 2022-06-11 01:11:34
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 274 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,272 KB
実行使用メモリ 257,764 KB
最終ジャッジ日時 2024-09-21 08:27:43
合計ジャッジ時間 13,462 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 RE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[[0,i] for i in range(M)]
for a in A:
	B[a%M][0]+=1
B.sort(reverse=True)
S=set()
ans=0
for c,v in B:
	if 2*v%M==0:
		ans+=(c>0)
		S.add(v)
	else:
		if v not in S:
			ans+=c
			S.add(v)
			S.add(M-v)
print(ans)
0