#P5633. Rikka with Sequence
Rikka with Sequence
Problem Description
As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them:
Yuta has an array $A$ of length $n$,for each $i(1 \leq i \leq n)$, $A[i]$ is integer and satisfies $1 \leq A[i] \leq m$. Rikka wants to add some **real** numbers in $[1,m]$ to the array in order to make the average number of $A$ less than or equal to the median number of $A$.
Now, Yuta wants to minimize the number of the added numbers, and on this basis, he wants to minimize the average number of $A$.
It is too difficult for Rikka. Can you help her?
Input
The first line contains a number $T(T \leq 1000)$——The number of the testcases. And there are no more than 5 testcases with $n>100$
For each testcase, the first line contains two numbers $n,m(1 \leq n \leq 10^5,1 \leq m \leq 10^9)$.
And the second line contains exactly $n$ numbers $A[i]$.
Output
For each testcase, print two numbers: the minimal number of the added numbers and the minimal average number of $A$. For the second number, You only need to reserve three decimal places.
1
3 5
1 2 5
1 3.000
You can insert a single number $4.000$.