#K70897. Distinct Books Challenge

    ID: 33410 Type: Default 1000ms 256MiB

Distinct Books Challenge

Distinct Books Challenge

You are given information about several book club test cases. In each test case, the first number represents the number of club members, followed by the number of books each member has read.

Your task is to compute two values for each test case:

  • Distinct Count: The number of distinct (unique) book counts read by the members.
  • Total Sum: The sum of the books read by all members.

Mathematically, if a test case is given as \(N\) (the number of members) and the list \(a_1, a_2, \dots, a_N\) representing the number of books read by each member then:

[ \text{Distinct Count} = \left| {a_1, a_2, \dots, a_N} \right|, \quad \text{Total Sum} = \sum_{i=1}^{N}a_i ]

For example, if a test case is "3 2 3 5", then the distinct set is {2, 3, 5} which gives a distinct count of 3, and the total sum is \(2+3+5=10\).

inputFormat

The input is given via standard input (stdin) and has the following format:

  1. The first line contains an integer \(T\) denoting the number of test cases.
  2. Each of the next \(T\) lines represents a test case. Each test case starts with an integer \(N\) which indicates the number of club members, followed by \(N\) space-separated integers representing the number of books read by each member.

outputFormat

For each test case, output a line containing two space-separated integers: the distinct count (number of unique book counts) and the total sum of books read.

## sample
2
3 2 3 5
4 1 1 1 1
3 10

1 4

</p>