Рюкзак с массами
Easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
Given items with mass and cost respectively.
They fill the knapsack, that can withstand a weight of no more than . Determine the set of items that can be carried in the knapsack that has the highest cost.
Input
The first line contains a positive integer — the weight of the knapsack.
The second line contains positive integers — the weights of the items.
The third line contains positive integers — the cost of the items.
Output
Print the numbers of items (numbers from to ) that will be included in the knapsack with the highest cost.
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 21%