結果

問題 No.45 回転寿司
ユーザー letrangerjpletrangerjp
提出日時 2017-06-15 16:16:41
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 161 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 11,980 KB
実行使用メモリ 16,236 KB
最終ジャッジ日時 2023-10-25 06:55:51
合計ジャッジ時間 4,017 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
16,180 KB
testcase_01 AC 84 ms
16,180 KB
testcase_02 WA -
testcase_03 AC 85 ms
16,192 KB
testcase_04 AC 85 ms
16,180 KB
testcase_05 AC 85 ms
16,180 KB
testcase_06 AC 85 ms
16,180 KB
testcase_07 AC 84 ms
16,184 KB
testcase_08 WA -
testcase_09 AC 84 ms
16,184 KB
testcase_10 AC 83 ms
16,180 KB
testcase_11 WA -
testcase_12 AC 83 ms
16,184 KB
testcase_13 AC 83 ms
16,180 KB
testcase_14 AC 82 ms
16,180 KB
testcase_15 AC 83 ms
16,180 KB
testcase_16 WA -
testcase_17 AC 82 ms
16,180 KB
testcase_18 AC 84 ms
16,180 KB
testcase_19 WA -
testcase_20 AC 86 ms
16,180 KB
testcase_21 AC 84 ms
16,180 KB
testcase_22 AC 82 ms
16,180 KB
testcase_23 WA -
testcase_24 AC 86 ms
16,180 KB
testcase_25 AC 86 ms
16,180 KB
testcase_26 AC 84 ms
16,180 KB
testcase_27 WA -
testcase_28 AC 85 ms
16,180 KB
testcase_29 AC 83 ms
16,180 KB
testcase_30 AC 84 ms
16,180 KB
testcase_31 AC 84 ms
16,180 KB
testcase_32 WA -
testcase_33 AC 82 ms
16,200 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
V = gets.split.map(&:to_i)
$dp = {}
def f(v ,i)
  $dp[i] ||= if i < 2
    V[i]
  else
    [V[i] + f(v, i-2), f(v, i-1)].max
  end
end

p f(0, N-1)
0