White Cloud placed n containers in sequence on a axes. The i-th container is located at x[i] and there are a[i] number of products in it. White Rabbit wants to buy some products. The products which are required to be sold must be placed in the same container. The cost of moving a product from container u to container v is 2*abs. White Cloud wants to know the maximum number of products it can sell. The total cost can't exceed T.
White Cloud placed n containers in sequence on a axes. The i-th container is located at x[i] and there are a[i] number of products in it. White Rabbit wants to buy some products. The products which are required to be sold must be placed in the same container. The cost of moving a product from container u to container v is 2*abs(x[u]-x[v]). White Cloud wants to know the maximum number of products it can sell. The total cost can't exceed T.
(图片来源网络,侵删)