結果

問題 No.2424 Josouzai
ユーザー tomeruntomerun
提出日時 2023-08-18 21:02:12
言語 Crystal
(1.11.2)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 203 bytes
コンパイル時間 12,113 ms
コンパイル使用メモリ 295,264 KB
実行使用メモリ 19,072 KB
最終ジャッジ日時 2024-05-06 02:28:23
合計ジャッジ時間 14,299 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 1 ms
5,248 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 17 ms
7,680 KB
testcase_05 AC 54 ms
18,944 KB
testcase_06 AC 53 ms
19,072 KB
testcase_07 AC 54 ms
19,072 KB
testcase_08 AC 55 ms
19,072 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 11 ms
7,040 KB
testcase_11 AC 26 ms
15,988 KB
testcase_12 AC 20 ms
13,696 KB
testcase_13 AC 17 ms
7,680 KB
testcase_14 AC 30 ms
12,160 KB
testcase_15 AC 6 ms
5,376 KB
testcase_16 AC 45 ms
15,744 KB
testcase_17 AC 13 ms
6,528 KB
testcase_18 AC 15 ms
7,552 KB
testcase_19 AC 24 ms
9,216 KB
testcase_20 AC 48 ms
15,832 KB
testcase_21 AC 36 ms
13,568 KB
testcase_22 AC 16 ms
7,680 KB
testcase_23 AC 20 ms
8,320 KB
testcase_24 AC 9 ms
5,376 KB
testcase_25 AC 48 ms
15,616 KB
testcase_26 AC 37 ms
13,824 KB
testcase_27 AC 52 ms
16,768 KB
testcase_28 AC 44 ms
15,232 KB
testcase_29 AC 38 ms
13,952 KB
testcase_30 AC 10 ms
5,504 KB
testcase_31 AC 24 ms
9,216 KB
testcase_32 AC 49 ms
16,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = read_line.split.map(&.to_i)
a = read_line.split.map(&.to_i64).sort
sum = 0i64
n.times do |i|
  if sum + a[i] > k
    puts "#{i} #{k - sum}"
    exit
  end
  sum += a[i]
end
puts "#{n} #{k - sum}"
0