結果

問題 No.1972 Modulo Set
ユーザー hir355
提出日時 2022-06-10 21:50:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 107,648 KB
最終ジャッジ日時 2024-09-21 06:12:46
合計ジャッジ時間 4,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] %= m
c = Counter(a)
ans = 0
st = set()
for k, v in c.items():
    if k * 2 != m and m - k not in st:
        st.add(k)
        ans += max(v, c[m - k])
if m % 2 == 0 and c[m // 2] > 0:
    ans += 1
print(ans)
0