[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]);