結果

問題 No.1972 Modulo Set
ユーザー shobonvip
提出日時 2022-06-11 15:26:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,856 KB
実行使用メモリ 108,692 KB
最終ジャッジ日時 2024-10-05 01:44:56
合計ジャッジ時間 4,235 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n,m = map(int,input().split())
a = list(map(int,input().split()))
ac = defaultdict(int)

for i in a:
	ac[i%m] += 1

ans = 0
for i, j in list(ac.items()):
	if i == (m-i)%m and j >= 1:
		ans += 1
	elif j > ac[(m-i)%m]:
		ans += j
	elif j == ac[(m-i)%m] and i > (m-i)%m:
		ans += j

print(ans)
0