The supermarket has N items, numbered from 1 to N. Item i has a weight of wi and a value of vi.
You decided to go to the supermarket with a knapsack that can hold up to a weight of S. Unlike other supermarkets, this is a special one. It allows all customers to split split their food in however way they want based on weight. So if someone splits an apple of weight 5 and value 3 to an apple of weight 2 and 3, the values of the split apples will be 3/5 * 2 and 3/5 * 3 respectively.
You do not care what type of item uou take, only the value. Calculate the maximum value of items you can take with your knapsack.
Input in given in the following way
N S
w1 v1
w2 v2
w3 v3
. .
. .
wn vn
5 10
2 3
3 2
1 4
5 4
3 3
Subtask | Score |
---|---|
1 | 100 |
2 | 0 |