結果
問題 | No.617 Nafmo、買い出しに行く |
ユーザー | TANIGUCHI Kousuke |
提出日時 | 2019-11-13 11:29:34 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 229 bytes |
コンパイル時間 | 50 ms |
コンパイル使用メモリ | 11,908 KB |
実行使用メモリ | 114,200 KB |
最終ジャッジ日時 | 2023-10-21 19:40:49 |
合計ジャッジ時間 | 8,238 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 352 ms
40,324 KB |
testcase_01 | AC | 78 ms
16,312 KB |
testcase_02 | AC | 480 ms
50,316 KB |
testcase_03 | AC | 1,176 ms
80,024 KB |
testcase_04 | AC | 153 ms
23,016 KB |
testcase_05 | AC | 1,979 ms
86,568 KB |
testcase_06 | TLE | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
N,K = gets.split.map(&:to_i) A = N.times.map{gets.to_i} dp = Array.new(K + 1, 0).tap{|it| it[0] = 1 } A.each do |a| (0 .. K).reverse_each do |k| dp[k + a] += 1 if dp[k] > 0 && a + k <= K end end puts dp.rindex{|v| v > 0 }