#C4768. Road Trip Snacks
Road Trip Snacks
Road Trip Snacks
You are given T test cases. In each test case, you are given N snacks with their calorie counts and a calorie limit C. Your task is to choose the maximum number of snacks such that the total calories do not exceed C. Moreover, the chosen snacks must result in the minimum possible total calories among all selections that achieve this maximum number. This can be formulated as follows: Given a sorted array (a_1, a_2, \dots, a_N) (in increasing order), choose the largest (k) such that (\sum_{i=1}^{k} a_i \leq C). If no snack can be selected, output 0 for both the number of snacks and the total calorie count.
inputFormat
The first line contains an integer T, denoting the number of test cases. Each test case consists of two lines. The first line of a test case contains two integers N and C, where N is the number of snacks and C is the maximum allowed total calories. The second line contains N space-separated integers representing the calorie counts of the snacks.
outputFormat
For each test case, output two integers separated by a space: the maximum number of snacks that can be chosen and the total calories of those snacks. Each test case's result should be printed on a separate line.## sample
2
5 10
1 2 3 4 5
3 3
4 5 6
4 10
0 0
</p>