#B3873. Minimum Cost Beverage Selection
Minimum Cost Beverage Selection
Minimum Cost Beverage Selection
Little Yang visits a store that sells N types of beverages, each with a unique type indexed from 0 to N-1. The beverage of type i is sold at a price of c_i dollars and has a volume of l_i milliliters.
Little Yang has the following requirements:
- He wants to try as many different types of beverages as possible. Hence, he will purchase at most one bottle of each type.
- He is very thirsty, so he requires that the total volume of the selected beverages is at least \(L\) milliliters.
- He is cost-conscious. Under the previous constraints, he wants to spend as little money as possible.
Your task is to output the minimum cost required to satisfy his needs. In particular, if it is not possible to satisfy the requirements, output no solution
.
The main challenge of the problem is to select a subset of drinks (each at most once) such that the sum of volumes is at least \(L\) and the sum of costs is minimized.
Note: All formulas are formatted in LaTeX. For example, the required volume is represented as \(L\) and for the ith beverage its cost and volume are \(c_i\) and \(l_i\) respectively.
inputFormat
The first line contains two integers: N (the number of beverage types) and L (the minimum total volume required in milliliters).
The following N lines each contain two integers: ci and li representing the cost and volume of the ith beverage respectively.
outputFormat
Output a single line containing the minimum total cost to obtain at least \(L\) milliliters of beverages. If it is impossible, output no solution
.
sample
3 10
5 6
4 5
3 4
7