結果

問題 No.484 収穫
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-19 15:48:44
言語 Ruby
(3.2.2)
結果
AC  
実行時間 1,099 ms / 3,000 ms
コード長 312 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 11,264 KB
実行使用メモリ 77,892 KB
最終ジャッジ日時 2023-09-24 23:34:14
合計ジャッジ時間 15,390 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,056 KB
testcase_01 AC 80 ms
15,196 KB
testcase_02 AC 80 ms
15,352 KB
testcase_03 AC 81 ms
15,332 KB
testcase_04 AC 80 ms
15,004 KB
testcase_05 AC 81 ms
15,084 KB
testcase_06 AC 85 ms
15,064 KB
testcase_07 AC 82 ms
15,116 KB
testcase_08 AC 83 ms
15,276 KB
testcase_09 AC 95 ms
16,140 KB
testcase_10 AC 94 ms
16,132 KB
testcase_11 AC 92 ms
16,208 KB
testcase_12 AC 1,099 ms
77,688 KB
testcase_13 AC 1,091 ms
77,784 KB
testcase_14 AC 1,092 ms
77,776 KB
testcase_15 AC 1,099 ms
77,832 KB
testcase_16 AC 1,096 ms
77,876 KB
testcase_17 AC 1,093 ms
77,836 KB
testcase_18 AC 1,091 ms
77,792 KB
testcase_19 AC 1,094 ms
77,664 KB
testcase_20 AC 1,094 ms
77,892 KB
testcase_21 AC 1,088 ms
77,848 KB
testcase_22 AC 1,092 ms
77,664 KB
testcase_23 AC 1,088 ms
77,872 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
a=gets.split.map &:to_i
f=2e9
r=0...n
d=r.map{[f]*n}
e=r.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 r.map{|i|[[d[i][i],e[i][i]].min,a[i]].max}.min
0