結果

問題 No.2424 Josouzai
ユーザー simansiman
提出日時 2023-08-19 17:54:26
言語 Ruby
(3.3.0)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 190 bytes
コンパイル時間 629 ms
コンパイル使用メモリ 11,376 KB
実行使用メモリ 31,504 KB
最終ジャッジ日時 2023-08-19 17:54:37
合計ジャッジ時間 9,379 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
15,076 KB
testcase_01 AC 69 ms
15,248 KB
testcase_02 AC 70 ms
15,268 KB
testcase_03 AC 67 ms
15,164 KB
testcase_04 AC 96 ms
19,900 KB
testcase_05 AC 167 ms
31,496 KB
testcase_06 AC 167 ms
31,432 KB
testcase_07 AC 182 ms
31,344 KB
testcase_08 AC 169 ms
31,504 KB
testcase_09 AC 69 ms
15,180 KB
testcase_10 AC 94 ms
19,632 KB
testcase_11 AC 146 ms
29,536 KB
testcase_12 AC 125 ms
25,772 KB
testcase_13 AC 98 ms
19,956 KB
testcase_14 AC 124 ms
24,328 KB
testcase_15 AC 74 ms
15,936 KB
testcase_16 AC 178 ms
29,628 KB
testcase_17 AC 92 ms
18,788 KB
testcase_18 AC 95 ms
19,700 KB
testcase_19 AC 122 ms
22,744 KB
testcase_20 AC 159 ms
29,516 KB
testcase_21 AC 138 ms
26,260 KB
testcase_22 AC 101 ms
19,964 KB
testcase_23 AC 106 ms
21,096 KB
testcase_24 AC 86 ms
17,608 KB
testcase_25 AC 184 ms
30,268 KB
testcase_26 AC 137 ms
26,464 KB
testcase_27 AC 166 ms
31,140 KB
testcase_28 AC 155 ms
28,540 KB
testcase_29 AC 146 ms
27,244 KB
testcase_30 AC 86 ms
18,016 KB
testcase_31 AC 109 ms
21,960 KB
testcase_32 AC 166 ms
30,608 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

ans = 0
remain = K
while A.size > 0 && A[0] <= remain
  ans += 1
  remain -= A[0]

  A.shift
end

puts [ans, remain].join(' ')
0