P22134 [CodeChef] CHNUM
普及-
题目描述

Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Recently, Chef hosted a strange competition at the Byteland annual fair. There were $N$ participants in the competition (numbered $1$ through $N$); at the end of the competition, their scores were $A_{1}, A_{2}, \ldots, A_{N}$. Since it was a strange competition, negative scores were allowed too.

The total score of the competition is calculated as follows:
Divide the participants into one or more non-empty groups (subsets); if there are $K$ groups, let's denote them by $G_{1}, G_{2}, \ldots, G_{K}$. Each participant should be a member of exactly one group.
Sum up the scores of participants in each individual group. For each valid $i$, let's denote the sum of scores of participants in group $i$ by $X_{i}$.
The total score of the competition is the sum of squares of these summed up scores, i.e. $X_{1}^{2} + X_{2}^{2} + \ldots + X_{K}^{2}$.

Chef wants to choose the groups in such a way that the total score is maximum possible. Since there may be many ways to form the groups that lead to the maximum total score, Chef wants to know just the size of the largest group and the size of the smallest group which could be formed while still maximising the total score. These sizes are independent - formally, they are the maximum and minimum size $s$ of a group such that there is a way to form groups which maximises the total score and contains a group with size $s$.

------ Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first line of each test case contains a single integer $N$.
The second line contains $N$ space-separated integers $A_{1}, A_{2}, \ldots, A_{N}$.

------ Output ------
For each test case, print a single line containing two space-separated integers - the size of the largest possible group and the size of the smallest possible group.

------ Constraints ------
$1 ≤ T ≤ 20$
$1 ≤ N ≤ 10^{5}$
$1 ≤ |A_{i}| ≤ 10^{9}$ for each valid $i$
the sum of $N$ over all test cases does not exceed $5 \cdot 10^{5}$

------ Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------
1

5

5 2 4 6 7
----- Sample Output 1 ------
5 5
----- explanation 1 ------
Example case 1: To maximise the total score, everyone has to belong to the same group with scores $[5, 2, 4, 6, 7]$. For this group, $X = 5+2+4+6+7 = 24$ and the total score is $24^{2} = 576$. The size of the largest possible group, as well as the size of the smallest possible group, is $5$.

输入格式

见题面

输出格式

见题面

样例输入
1 5 5 2 4 6 7
样例输出
5 5