結果

問題 No.1972 Modulo Set
ユーザー simansiman
提出日時 2022-06-11 09:31:34
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 209 bytes
コンパイル時間 63 ms
コンパイル使用メモリ 11,924 KB
実行使用メモリ 27,552 KB
最終ジャッジ日時 2023-10-21 16:45:06
合計ジャッジ時間 10,691 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
16,096 KB
testcase_01 AC 85 ms
16,096 KB
testcase_02 AC 83 ms
16,096 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 87 ms
16,356 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 90 ms
16,620 KB
testcase_14 AC 89 ms
16,620 KB
testcase_15 WA -
testcase_16 AC 134 ms
23,976 KB
testcase_17 AC 104 ms
18,560 KB
testcase_18 AC 83 ms
16,096 KB
testcase_19 AC 126 ms
22,708 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 125 ms
21,988 KB
testcase_23 AC 211 ms
27,332 KB
testcase_24 AC 168 ms
19,564 KB
testcase_25 AC 195 ms
22,216 KB
testcase_26 WA -
testcase_27 AC 233 ms
27,552 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, M = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

counter = A.map { |a| a % M }.tally
counter.default = 0

ans = 0

0.upto(M / 2) do |i|
  j = M - i

  ans += [counter[i], counter[j]].max
end

puts ans
0