#ENGLISHP04. 0/1 Knapsack
0/1 Knapsack
Description
Given the weights and values of N items, put a subset of items into a knapsack of capacity C to get the maximum total value in the knapsack. The total weight of items in the knapsack does not exceed C.
Input Format
First line: two positive integers N (N <= 100) and C (C <= 1000).
Second line: N positive integers w[i] (w[i] <= 1000), indicating the weight of the i-th item.
Third line: N positive integers v[i] (v[i] <= 1000), indicating the value of the i-th item.
Output Format
One line contains several integers, indicating the indexes of the selected items.
5 10
2 4 6 2 5
1 3 4 2 8
2
5