#P4217. [CTSC2010] 产品销售
[CTSC2010] 产品销售
Description
Company A is seeing strong sales of a certain computer product. As the CEO of Company A, Xiao A plans to make a detailed production and sales plan for the next consecutive sales quarters. It is known that in the -th sales quarter the order quantity is . In quarter , Company A may meet the orders in the following ways:
- Produce new products in quarter to sell.
- If there is remaining inventory before quarter , it can be sold directly in quarter (note that there is no inventory before the first quarter).
- In quarter , it is allowed to leave part of the orders unfilled and postpone them, merging them into the order quantity of the next quarter .
Company A needs to consider the following costs: the production cost for new products, the additional storage cost for inventory, and the compensation paid to users for delayed orders. Moreover, due to labor and resource limitations, the number of new products that can be produced in each sales quarter is limited, and both the costs and production upper bounds differ by quarter, as follows:
- In quarter , at most new units can be produced, and the cost per unit is .
- Products kept at the end of quarter for use in later quarters incur a storage fee: for each unit kept from quarter to quarter , an extra fee of must be paid (note that once kept to the next quarter, the product may remain in inventory again).
- For each unit postponed from quarter and merged into the next quarter’s order quantity, Company A must compensate users (note that an order postponed to the next quarter may be postponed again, and the fee is charged according to the later quarter’s delay fee).
By the end of quarter , Company A must have fulfilled all user orders. It is guaranteed that the total number of units the company can produce is not less than the total order quantity; that is, there exists at least one production and sales plan that satisfies all orders. Xiao A wants to know how to arrange production and sales so that, while satisfying all orders, the total cost is minimized.
Input Format
The first line of the input file contains a positive integer , the number of sales quarters.
The second line contains non-negative integers , where is the order quantity in quarter .
The third line contains non-negative integers , where is the maximum number of new units that can be produced in quarter .
The fourth line contains non-negative integers , where is the per-unit production cost in quarter .
The fifth line contains non-negative integers , where is the additional storage fee to keep one unit from quarter to quarter .
The sixth line contains non-negative integers , where is the compensation paid if one unit’s order is not fulfilled in quarter and is merged into the order quantity of quarter .
Output Format
The output file contains a single non-negative integer, the minimal total cost.
4
3 2 1 2
2 5 2 2
5 1 5 5
1 2 1
5 3 3
30
Hint
Sample Explanation:
In the first quarter, produce units. In the second quarter, produce units. In the third quarter, produce no units. In the fourth quarter, produce unit. The production cost is .
Since at most units can be produced in the first quarter, the -unit order cannot be fully met; thus unit is postponed to the second quarter, incurring a compensation of .
In the second quarter, because unit was postponed from the first quarter, the order quantity becomes . This quarter produces units, leaving units in inventory. In the third quarter, sell directly from inventory; the extra unit is further stored to the fourth quarter. Together with producing unit in the fourth quarter, all orders are satisfied. The total storage cost is .
The total cost is .
Constraints:
- For of the testdata, .
- For of the testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号