Question about convex hull ?
Разница между en2 и en3, 12 символ(ов) изменены
I have a problem which I don't really understand the solution.``

``Give n buckets of water. The i_th bucket contains a_i liters of water. You can move water from bucket i to bucket i + 1.The cost when you move water is exactly the amount of water.Find the minimum cost you have to do that a_i <= a_i+1 <= ... <= a_n.``↵

``The solution is quite easy to read,but I can't prove it right.First, you must create n + 1 points from the input, the coordinates are {0;0},{1;s_i},...,{n,s_n} with s_i is prefix sum of array a_i from 1 to i.After that,you run a loop from 0 to n-2.If 3 consecutive points is not counter clockwise(ccw for short), then you add the area of the triangle with peaks are these 3 points to the result.``↵

Is this an application of convex hull,or is there any documents about this problem type ?
``

Thank you and apologize for my bad English. It's not my mother language.
``

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский Cqt_Iostream 2019-08-14 05:40:30 12
en2 Английский Cqt_Iostream 2019-08-14 05:38:09 26
en1 Английский Cqt_Iostream 2019-08-14 05:36:41 911 Initial revision (published)