結果

問題 No.2334 Distinct Cards
ユーザー gemmarogemmaro
提出日時 2023-07-05 09:03:06
言語 Ruby
(3.3.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 162 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 11,496 KB
実行使用メモリ 27,392 KB
最終ジャッジ日時 2023-09-26 08:21:16
合計ジャッジ時間 6,010 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,152 KB
testcase_01 AC 82 ms
15,072 KB
testcase_02 AC 82 ms
15,160 KB
testcase_03 AC 82 ms
15,004 KB
testcase_04 AC 85 ms
14,996 KB
testcase_05 AC 82 ms
15,004 KB
testcase_06 AC 83 ms
15,068 KB
testcase_07 AC 84 ms
15,276 KB
testcase_08 AC 85 ms
15,240 KB
testcase_09 AC 83 ms
15,044 KB
testcase_10 AC 83 ms
15,032 KB
testcase_11 AC 84 ms
15,076 KB
testcase_12 AC 147 ms
25,108 KB
testcase_13 AC 146 ms
24,904 KB
testcase_14 AC 151 ms
25,020 KB
testcase_15 AC 145 ms
24,928 KB
testcase_16 AC 146 ms
25,028 KB
testcase_17 AC 147 ms
27,136 KB
testcase_18 AC 151 ms
27,392 KB
testcase_19 AC 154 ms
27,108 KB
testcase_20 AC 131 ms
21,600 KB
testcase_21 AC 132 ms
21,768 KB
testcase_22 AC 128 ms
21,612 KB
testcase_23 AC 83 ms
15,084 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K = gets.split.map(&:to_i)
AS = gets.split.map(&:to_i)

r = K
i = 0
AS.tally.values.sort.reverse_each do |n|
  break unless r > 0
  r -= n
  i += 1
end
puts i
0