SP21061 YASSP - Yet Another Subset Sum Problem

Description

Let **Y** be an array of integers of size **N**. Let **G(x)** be a set comprising of the size of all the subsets of the array Y whose sum is **x**. Let **F(G(x))** denote the number of unique elements in the set **G(x)**. Your task is to find the _maximum value of F(G(x))_ and the _corresponding value x_ for the given array Y. In Case, many 'x' correspond to maximum F(G(x)), _print the smallest one_.

Input Format

The first line describes the number of test cases T. The input contains several test cases, each one described in exactly two lines. The first line contains an integer N indicating the number of elements in the array. The second line contains N integers separated by single spaces, representing the elements of the array.

Output Format

For every test case, print two integers: maximum F(G(x)) and the minimum value of x corresponding to it. **Constraints** T