OPTCUT - Chặt cây

You have to cut a piece of wood into n smaller pieces, each piece is of length ai. The pieces must be cut in order exactly a1, a2, ..., an from left to right.

At each step, you may cut a piece into two smaller pieces. The cost for that cut is the length of the piece before cut.

Different cut order will result in different costs.

Find the minimum cost to cut the initial piece into n given smaller pieces.


Được gửi lên bởi:Jimmy
Ngày:2009-03-03
Thời gian chạy:0.200s
Giới hạn mã nguồn:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:Tất cả ngoại trừ: ERL GOSU JS-RHINO PERL6 PYPY RUST SED

hide comments
2021-05-27 18:02:48
Tham khảo: https://vnspoj.github.io/problems/OPTCUT
2021-01-15 10:17:37
qua de voi tran duc manh
2020-03-18 16:36:54
sao cứ bị WA test 1 mãi thế huhu :((
2018-01-09 15:24:11
Làm sao O(N^2) nhỉ. Chẳng lẽ mỗi lần đều chặt rìa.
2017-08-29 03:31:06
O(n) và dell qua test 1. đm
2017-03-01 09:30:51
ai biết test 1 là j ko v @@
2016-11-21 16:48:50
test kiểu gì mà WA ở test 1 thế nhỉ
2016-07-09 21:11:11 noname00.pas
Mình có tham khảo bài viết về "Quy học động tăng tốc"
Code
http://ideone.com/DE4kj0
2015-09-08 14:10:34
https://thewizard6296.wordpress.com/2015/09/04/5/
2015-05-07 04:09:12 lucky++
A di đà phật. Nhị phân sai, O(N3) quá lâu, O(N2) AC, mất toi cả ngày.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.