結果

問題 No.1972 Modulo Set
ユーザー Issei Mori
提出日時 2022-06-10 21:37:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 126,136 KB
最終ジャッジ日時 2024-09-21 06:04:21
合計ジャッジ時間 4,806 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


def get_list(ty=int):
    return list(map(ty, input().split()))


def get_int():
    return int(input())


def get_str():
    return input()


N, M = get_list()
A = get_list()

cnt = defaultdict(int)
for a in A:
    cnt[a % M] += 1

ans = 0
if cnt[0] > 0:
    ans += 1

keys = cnt.keys()
used = {0}
for k in list(keys):
    if not k in used:
        used.add(k)
        k2 = M-k
        used.add(k2)
        ans += max(cnt[k], cnt[k2])

print(ans)


0