結果

問題 No.1972 Modulo Set
ユーザー roaris
提出日時 2022-06-10 22:20:22
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 337 bytes
コンパイル時間 315 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 694,160 KB
最終ジャッジ日時 2024-09-21 06:30:01
合計ジャッジ時間 7,006 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 MLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

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

for Ai in A:
    cnt[Ai%M] += 1

ans = 0

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

ans += min(1, cnt[0])

if M%2==0:
    ans += min(1, cnt[M//2])

print(ans)
0