Optimization of the DP slope in the garbage collection Series

Source: Internet
Author: User

Optimization of the DP slope in the garbage collection Series

Returned by the madman

It seems that the slope Optimization of DP has been very difficult, especially the scum of mathematics such as mine. I don't know what convex bag, what is convex and convex, ah... When talking about it, It is tears. I discussed it with WDD and came to some conclusions. Most of the articles in this Article refer to the accept article, but it seems that this article has been well written and poorly written. The first half is well described, but the key is, the key part is messy, with some mistakes. Many gods commented, but accept seems to have not changed the meaning, so I will resummarize it so that I can check and review it later.

The following is an example of print article. Printing a continuous article from I to J requires m + sigma (sum [J]-sum [I]) 2, and calculates the minimum fee for printing this article. The minimum charge is the number of times the data is printed. DP [I] indicates the minimum cost of printing from 1 .. I.

We have the DP transfer equation DP [I] = min (DP [J] + sigma (m + sum [I]-sum [J]) 2, DP [I]), j <I; check whether the data volume is 0 ≤ n ≤ 500000, and 0 ≤ m ≤, 50 thousand. If this is done directly, it is the complexity of O (n2) and the timeout is no doubt. How can this problem be solved? How to optimize the DP slope?

Optimization of the DP slope in the garbage collection Series

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.