#C6388. Calculate Seating Capacity

    ID: 50142 Type: Default 1000ms 256MiB

Calculate Seating Capacity

Calculate Seating Capacity

You are given several test cases. Each test case represents a set of loops having a fixed number of seats. For each test case, the first input is an integer n which indicates the number of loops. The next line contains n space-separated integers where each integer represents the seating capacity of a loop.

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

  • The total seating capacity, which is the sum of seats from all loops.
  • The maximum seating capacity from a single loop, i.e. the maximum among the given seats.

Mathematically, if a test case contains n loops with capacities \(a_1,a_2,...,a_n\), you need to calculate:

\[ \text{Total} = \sum_{i=1}^{n} a_i, \quad \text{Maximum} = \max_{1\le i\le n} a_i \]

Print the result for each test case on a new line with the two values separated by a space.

inputFormat

The first line of input contains an integer T, representing the number of test cases. This is followed by T test cases.

For each test case, the input is structured as follows:

  1. A line with an integer n, representing the number of loops.
  2. A line with n space-separated integers denoting the seating capacities of the loops.

outputFormat

For each test case, output a single line containing two space-separated integers:

  1. The total seating capacity of all loops.
  2. The seating capacity of the loop that can accommodate the maximum number of guests.
## sample
2
1
10
2
4 6
10 10

10 6

</p>