#t331. 背包问题(snap)
背包问题(snap)
The Knapsack Problem
Problem Background
Special for beginners, ^_^
Problem Description
A simple knapsack problem. There is a knapsack with a maximum load capacity of . There are items whose weights are , all positive integers. Choose some of the items so that the sum of their weights is exactly . Finding any one valid solution is enough.
Input Format
The first line contains the total number of items and the capacity of the knapsack. The second line contains the weight of each item.
Output Format
For each selected item, output its index and its weight, one item per line.
If there is no solution, output not found (the output does not include the quotation marks).
Sample Input
5 10
1 2 3 4 5
Sample Output
1 1
2 2
3 3
4 4
Constraints
1s, 1024KiB for each test case.