結果

問題 No.1972 Modulo Set
ユーザー qibqib
提出日時 2023-04-01 00:46:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 435 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 81,764 KB
実行使用メモリ 113,540 KB
最終ジャッジ日時 2023-10-24 10:39:47
合計ジャッジ時間 5,830 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,484 KB
testcase_01 AC 38 ms
53,484 KB
testcase_02 AC 37 ms
53,484 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 47 ms
64,460 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 46 ms
64,572 KB
testcase_14 AC 53 ms
66,648 KB
testcase_15 WA -
testcase_16 AC 87 ms
93,532 KB
testcase_17 AC 59 ms
75,632 KB
testcase_18 AC 35 ms
53,484 KB
testcase_19 AC 80 ms
93,120 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 78 ms
91,664 KB
testcase_23 AC 121 ms
103,940 KB
testcase_24 AC 73 ms
87,312 KB
testcase_25 AC 85 ms
100,768 KB
testcase_26 WA -
testcase_27 AC 121 ms
104,036 KB
testcase_28 AC 67 ms
86,364 KB
testcase_29 AC 80 ms
98,632 KB
testcase_30 AC 98 ms
113,540 KB
testcase_31 AC 43 ms
64,436 KB
testcase_32 AC 92 ms
108,768 KB
testcase_33 AC 129 ms
109,240 KB
testcase_34 AC 132 ms
109,248 KB
testcase_35 AC 132 ms
109,244 KB
testcase_36 AC 136 ms
109,224 KB
権限があれば一括ダウンロードができます

ソースコード

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