結果

問題 No.2424 Josouzai
ユーザー simansiman
提出日時 2023-08-19 17:54:26
言語 Ruby
(3.3.0)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 190 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 29,056 KB
最終ジャッジ日時 2024-05-07 00:53:27
合計ジャッジ時間 6,960 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
12,032 KB
testcase_01 AC 79 ms
12,032 KB
testcase_02 AC 75 ms
12,032 KB
testcase_03 AC 76 ms
12,032 KB
testcase_04 AC 111 ms
16,896 KB
testcase_05 AC 179 ms
28,928 KB
testcase_06 AC 179 ms
28,800 KB
testcase_07 AC 177 ms
28,672 KB
testcase_08 AC 177 ms
29,056 KB
testcase_09 AC 75 ms
12,032 KB
testcase_10 AC 103 ms
17,024 KB
testcase_11 AC 144 ms
27,008 KB
testcase_12 AC 129 ms
23,296 KB
testcase_13 AC 111 ms
17,152 KB
testcase_14 AC 133 ms
21,632 KB
testcase_15 AC 89 ms
13,056 KB
testcase_16 AC 170 ms
27,136 KB
testcase_17 AC 100 ms
15,744 KB
testcase_18 AC 104 ms
16,640 KB
testcase_19 AC 129 ms
19,584 KB
testcase_20 AC 168 ms
27,136 KB
testcase_21 AC 146 ms
23,680 KB
testcase_22 AC 115 ms
17,152 KB
testcase_23 AC 115 ms
18,048 KB
testcase_24 AC 96 ms
14,336 KB
testcase_25 AC 177 ms
27,776 KB
testcase_26 AC 148 ms
23,680 KB
testcase_27 AC 179 ms
28,544 KB
testcase_28 AC 164 ms
26,112 KB
testcase_29 AC 159 ms
24,960 KB
testcase_30 AC 96 ms
14,848 KB
testcase_31 AC 124 ms
18,944 KB
testcase_32 AC 178 ms
28,160 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