結果

問題 No.1972 Modulo Set
ユーザー H20H20
提出日時 2022-06-10 21:36:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 282 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 82,368 KB
実行使用メモリ 108,008 KB
最終ジャッジ日時 2024-09-21 06:03:45
合計ジャッジ時間 4,447 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N,M = map(int, input().split())
A = list(map(int, input().split()))
CA = collections.Counter()
for a in A:
    CA[a%M]+=1
    CA[M-a%M]+=0
ans = 0
for k,v in CA.items():
    if k*2==M or k==0:
        ans+=2
    else:
        ans+=max(CA[k],CA[M-k])
print(ans//2)
0