#K78262. Maximum Sum Subsequence Count
Maximum Sum Subsequence Count
Maximum Sum Subsequence Count
Given a collection of N integers, your task is to determine the number of distinct non-empty subsequences that yield the maximum possible sum. In each test case, you are provided with a list of integers. The maximum sum can be achieved by considering any non-empty combination of the occurrences of the maximum element in the list.
If the maximum element appears x times, then the answer is given by the formula: $$2^{x} - 1$$.
Note: Although each test case provides a second integer K (the maximum possible value), it is not used in the calculation.
inputFormat
The input is read from standard input (stdin) and has the following format:
T N1 K1 A1 A2 ... AN1 N2 K2 A1 A2 ... AN2 ... NT KT A1 A2 ... ANT
Here, T is the number of test cases. For each test case, the first line contains two integers: N (the number of elements in the collection) and K (the maximum possible value, which is not used in this problem). The next line contains N space-separated integers representing the elements of the collection.
outputFormat
For each test case, output a single integer on a new line which represents the number of distinct non-empty subsequences (formed by the occurrences of the maximum element) that yield the maximum sum. The result for each test case should be printed in the order of input.
## sample3
3 5
5 1 5
4 3
3 3 2 1
1 1
1
3
3
1
</p>