結果

問題 No.2424 Josouzai
ユーザー horiesinitihoriesiniti
提出日時 2023-08-21 04:50:19
言語 Ruby
(3.3.0)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 157 bytes
コンパイル時間 557 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 29,056 KB
最終ジャッジ日時 2024-05-08 10:23:04
合計ジャッジ時間 6,619 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
12,160 KB
testcase_01 AC 85 ms
12,160 KB
testcase_02 AC 81 ms
12,160 KB
testcase_03 AC 81 ms
12,160 KB
testcase_04 AC 117 ms
17,024 KB
testcase_05 AC 195 ms
29,056 KB
testcase_06 AC 189 ms
28,928 KB
testcase_07 AC 194 ms
28,928 KB
testcase_08 AC 198 ms
29,056 KB
testcase_09 AC 82 ms
12,160 KB
testcase_10 AC 115 ms
17,024 KB
testcase_11 AC 161 ms
27,136 KB
testcase_12 AC 141 ms
23,424 KB
testcase_13 AC 118 ms
17,664 KB
testcase_14 AC 143 ms
21,632 KB
testcase_15 AC 91 ms
13,056 KB
testcase_16 AC 179 ms
27,136 KB
testcase_17 AC 109 ms
15,744 KB
testcase_18 AC 112 ms
16,384 KB
testcase_19 AC 135 ms
19,712 KB
testcase_20 AC 181 ms
27,392 KB
testcase_21 AC 164 ms
23,808 KB
testcase_22 AC 120 ms
17,280 KB
testcase_23 AC 125 ms
18,176 KB
testcase_24 AC 101 ms
14,464 KB
testcase_25 AC 193 ms
27,904 KB
testcase_26 AC 156 ms
23,808 KB
testcase_27 AC 189 ms
28,544 KB
testcase_28 AC 174 ms
26,240 KB
testcase_29 AC 164 ms
24,832 KB
testcase_30 AC 100 ms
14,848 KB
testcase_31 AC 133 ms
19,072 KB
testcase_32 AC 190 ms
28,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,k=gets.split(" ").map{|e| e.to_i}
xs=gets.split(" ").map{|e| e.to_i}.sort
ans=0
n.times{|i|
	break if k-xs[i]<0
	k-=xs[i]
	ans=i+1
}
puts [ans,k].join(" ")
0