[bzoj]1010 Toy packing

Source: Internet
Author: User
Tags min
[bzoj]1010 Test Instructions:

Professor P was going to see the Olympics, but he couldn't give up his toys, so he decided to ship all the toys to Beijing. He uses his own compressor to press
It can turn any item into a pile and then into a special one-dimensional container. Professor P has an N-N toy numbered 1...N 1...N, and the first toy passes
After compression becomes a one-dimensional ci ci. For ease of finishing, Professor P requires that the number of toys in a one-dimensional container be continuous. And if a one-dimensional capacity
There are a number of toys in the device, then two pieces of toys to add a unit length of the filler, in the form of the first I I toys to J J Toys put to a
container, then the length of the container will be X=j−i+sigma (CK), I<=k<=j x=j-i+sigma (CK), I the cost of making the container is related to the length of the container, according to the professor,
If the container length is X, its production cost is (X−L) 2 (x-l) ^2. Where l l is a constant. Professor P does not care about the number of containers, he can make any length of the capacity
Even more than L L. But he wants the cost to be minimal. The following:

N2 N^2 is a direct DP on the can. But the complexity of it.
Optimization of the problem and its metaphysics.
First we write out the N2 n^2 equation to feel it.
Dp[i]=min (dp[j]+ (sum[i]−sum[j]+i−j−1−l) 2); Dp[i] = min (Dp[j] + (Sum[i]-sum[j] + i-j-1-l) ^2);
That's probably the thing. You can't see anything, right/(ㄒoㄒ)/Let's simplify this equation.
Set C=l+1,g[i]=sum[i]+i C = L + 1,g[i] = Sum[i] + I, then the upper type equals
Dp[i]=min (dp[j]+ (g[i]−g[j]−c) 2); Dp[i] = min (Dp[j] + (G[i]-g[j]-c) ^2);
After becoming such a formula, then consider the optimization (fall)
There is such a problem in slope optimization: If the recursion can become a shape like
Dp[i]=s[i]+min (F[j]−k[i]∗t[j]);

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.