結果

問題 No.484 収穫
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-19 15:44:37
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 328 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 11,228 KB
実行使用メモリ 77,988 KB
最終ジャッジ日時 2023-09-24 23:25:41
合計ジャッジ時間 15,486 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,236 KB
testcase_01 AC 82 ms
15,028 KB
testcase_02 WA -
testcase_03 AC 83 ms
15,236 KB
testcase_04 AC 84 ms
15,292 KB
testcase_05 AC 81 ms
15,024 KB
testcase_06 AC 81 ms
15,140 KB
testcase_07 AC 82 ms
15,132 KB
testcase_08 AC 82 ms
15,152 KB
testcase_09 AC 93 ms
16,276 KB
testcase_10 AC 93 ms
16,204 KB
testcase_11 AC 93 ms
16,088 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1,066 ms
77,748 KB
testcase_18 AC 1,073 ms
77,824 KB
testcase_19 AC 1,072 ms
77,824 KB
testcase_20 AC 1,067 ms
77,736 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
a=gets.split.map &:to_i
f=2e9
d=(0...n).map{[f]*n}
e=(0...n).map{[f]*n}
d[0][n-1]=e[0][n-1]=0
n.downto(1){|k|
  (n-k).times{|i|
    d[i+1][j=i+k]=[d[i+1][j],[[d[i][j],e[i][j]+k].min,a[i]].max+1].min
    e[i][j-1]=[d[i][j-1],[[d[i][j]+k,e[i][j]].min,a[j]].max+1].min
  }
}
p (0...n).map{|i|[d[i][i],e[i][i]].min}.min
0