結果

問題 No.1972 Modulo Set
ユーザー simansiman
提出日時 2022-06-11 09:33:38
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 227 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 27,576 KB
最終ジャッジ日時 2023-10-21 16:49:00
合計ジャッジ時間 8,269 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
16,120 KB
testcase_01 AC 89 ms
16,116 KB
testcase_02 AC 84 ms
16,116 KB
testcase_03 AC 95 ms
17,492 KB
testcase_04 AC 105 ms
18,392 KB
testcase_05 WA -
testcase_06 AC 116 ms
20,172 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 90 ms
16,376 KB
testcase_10 WA -
testcase_11 AC 130 ms
22,560 KB
testcase_12 AC 92 ms
17,096 KB
testcase_13 AC 93 ms
16,640 KB
testcase_14 AC 92 ms
16,640 KB
testcase_15 AC 130 ms
22,712 KB
testcase_16 AC 137 ms
24,000 KB
testcase_17 AC 106 ms
18,584 KB
testcase_18 AC 85 ms
16,112 KB
testcase_19 AC 129 ms
22,732 KB
testcase_20 AC 137 ms
23,864 KB
testcase_21 AC 106 ms
19,332 KB
testcase_22 AC 124 ms
22,012 KB
testcase_23 AC 211 ms
27,356 KB
testcase_24 AC 171 ms
19,588 KB
testcase_25 AC 198 ms
22,240 KB
testcase_26 WA -
testcase_27 AC 238 ms
27,576 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 = [1, counter[0]].min

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

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

puts ans
0