結果

問題 No.1972 Modulo Set
ユーザー qib
提出日時 2023-04-01 00:46:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 435 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 82,216 KB
実行使用メモリ 112,832 KB
最終ジャッジ日時 2024-09-23 03:03:36
合計ジャッジ時間 5,473 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(int, input().split()))

if m == 1:
  print("1")
  exit()

cnt = {}
for i in range(n):
  x = a[i] % m
  cnt[x] = cnt.get(x, 0) + 1

ans = 0
used = {}
for x in cnt.keys():
  y = m - x
  if not used.get(x, None) is None or not used.get(y, None) is None:
    continue

  used[x] = True
  used[y] = True
  if x == y:
    ans += 1
  else:
    ans += max(cnt.get(x, 0), cnt.get(y, 0))

print(ans)
0