結果

問題 No.1972 Modulo Set
ユーザー rlangevin
提出日時 2022-12-30 03:32:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,092 KB
実行使用メモリ 110,020 KB
最終ジャッジ日時 2024-11-25 01:40:55
合計ジャッジ時間 5,286 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

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

for a in A:
    D[a % M] += 1
    D[M - a % M] += 0
    
ans = 0
for k, v in D.items():
    ans += max(D[k], D[M - k])
    
if M % 2 == 0:
    ans -= D[M//2] * 2
    ans += min(1, D[M//2]) * 2
print(ans // 2)
0