結果

問題 No.1972 Modulo Set
ユーザー minimum
提出日時 2022-06-10 21:29:53
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 328 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 725,152 KB
最終ジャッジ日時 2024-09-21 05:59:45
合計ジャッジ時間 6,967 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 MLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


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

r = defaultdict(int)
for i in range(N):
    r[A[i] % M] += 1

ans = 0
if 0 in r:
    ans += 1
if M % 2 == 0 and (M // 2 in r):
    ans += 1

for i in range(1, (M - 1) // 2 + 1):
    ans += max(r[i], r[M - i])

print(ans)
0