結果

問題 No.1972 Modulo Set
ユーザー prussian_coder
提出日時 2022-06-10 21:55:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 265 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 82,696 KB
実行使用メモリ 110,364 KB
最終ジャッジ日時 2024-10-05 01:31:09
合計ジャッジ時間 5,101 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
from collections import Counter
A=Counter([int(x)%M for x in input().split()])
ans=0
T=set()
for a in A:
	if a*2==M or a==0:
		if A[a]>=1:
			ans+=1
	else:
		if not a in T:
			ans+=max(A[a],A[M-a])
			T.add(a)
			T.add(M-a)
print(ans)		
0