結果
問題 | No.45 回転寿司 |
ユーザー | d_nishiyama85 |
提出日時 | 2016-06-13 03:09:00 |
言語 | Ruby (3.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 377 bytes |
コンパイル時間 | 54 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 210,844 KB |
最終ジャッジ日時 | 2024-05-03 15:25:20 |
合計ジャッジ時間 | 16,814 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2,402 ms
98,560 KB |
testcase_01 | TLE | - |
testcase_02 | TLE | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
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 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
コンパイルメッセージ
Syntax OK
ソースコード
$n = gets.to_i $v = gets.strip.split.map{|e| e.to_i} $dp = {} $n.times {|i| $dp[i] = {}} def recursive i, now if i >= $n return now end if $dp[i].key?(now) return $dp[i][now] end # 今回の皿を取る場合 a = recursive(i + 2, now + $v[i]) # 見送る場合 b = recursive(i + 1, now) max = [a, b].max $dp[i][now] = max end puts recursive 0, 0