結果

問題 No.1972 Modulo Set
ユーザー titan23titan23
提出日時 2022-06-24 09:44:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,320 KB
実行使用メモリ 108,016 KB
最終ジャッジ日時 2024-04-25 15:35:32
合計ジャッジ時間 5,278 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,304 KB
testcase_01 AC 41 ms
54,912 KB
testcase_02 AC 40 ms
54,248 KB
testcase_03 AC 59 ms
71,568 KB
testcase_04 AC 61 ms
75,032 KB
testcase_05 AC 61 ms
75,848 KB
testcase_06 AC 69 ms
81,176 KB
testcase_07 AC 84 ms
90,008 KB
testcase_08 AC 57 ms
74,088 KB
testcase_09 AC 54 ms
66,344 KB
testcase_10 AC 60 ms
74,364 KB
testcase_11 AC 80 ms
88,884 KB
testcase_12 AC 58 ms
70,292 KB
testcase_13 AC 53 ms
67,100 KB
testcase_14 AC 56 ms
67,616 KB
testcase_15 AC 89 ms
92,064 KB
testcase_16 AC 96 ms
94,124 KB
testcase_17 AC 66 ms
77,676 KB
testcase_18 AC 40 ms
53,812 KB
testcase_19 AC 86 ms
89,352 KB
testcase_20 AC 96 ms
95,944 KB
testcase_21 AC 67 ms
79,640 KB
testcase_22 AC 81 ms
88,268 KB
testcase_23 AC 114 ms
102,732 KB
testcase_24 AC 72 ms
83,800 KB
testcase_25 AC 84 ms
94,888 KB
testcase_26 AC 100 ms
96,796 KB
testcase_27 AC 116 ms
104,204 KB
testcase_28 AC 68 ms
82,744 KB
testcase_29 AC 80 ms
93,296 KB
testcase_30 AC 94 ms
104,148 KB
testcase_31 AC 51 ms
64,928 KB
testcase_32 AC 91 ms
100,092 KB
testcase_33 AC 124 ms
107,432 KB
testcase_34 AC 125 ms
108,016 KB
testcase_35 AC 121 ms
107,940 KB
testcase_36 AC 123 ms
107,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import Counter

#  -----------------------  #

n, m = map(int, input().split())
A = list(map(lambda x: int(x)%m, input().split()))
cou = Counter(A)
ans = 0
st = set()
for k,v in cou.items():
  k %= m
  if k in st:
    continue

  if k == 0:
    ans += 1
    st.add(k)
  elif m % 2 == 0 and k == m//2:
    ans += 1
    st.add(k)
  else:
    ans += max(v, cou[m-k])
    st.add(m-k)
print(ans)
0