AtCoder Regular Contest 197 (Div. 2)
B
Greater Than Average
AtCoder
⌀ 1100
原题
← AC →
翻译中…

Problem Statement

翻译中…

Define the score of a non-empty integer sequence $x = (x_1, \ldots, x_n)$ as the number of elements of $x$ that are strictly greater than the average of $x$.

翻译中…

That is, the score of $x$ is the count of indices $i$ satisfying $x_i > \dfrac{x_1+\cdots+x_n}{n}$.

翻译中…

You are given a length-$N$ integer sequence $A = (A_1, \ldots, A_N)$. Find the maximum score of a non-empty subsequence of $A$.

翻译中…

There are $T$ test cases; solve each one.

翻译中…

Definition of subsequence A subsequence of $A$ is any sequence obtained by deleting zero or more elements from $A$ and keeping the remaining elements in their original order.

翻译中…

Constraints

翻译中…
  • $1\le T\le 2\times 10^5$
  • $2\le N\le 2\times 10^5$
  • $1\le A_i\le 10^9$
  • All input values are integers.
  • The sum of $N$ over all test cases is at most $2\times 10^5$.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\text{case}_1
\vdots
\text{case}_T

翻译中…

Each case is given in the following format:

翻译中…

N
A_1 \cdots A_N

翻译中…

Output

翻译中…

Print $T$ lines. The $i$-th line should contain the maximum score of a non-empty subsequence of $A$ for the $i$-th test case.

翻译中…

样例

Input #1
3
5
2 6 5 7 5
5
10 10 10 10 10
5
1 10 100 1000 10000
Output #1
3
0
1
For the first test case, below are examples of subsequences, their averages, and their scores. - $x = (A_1) = (2)$: the average is $2$, and the score is $0$. - $x = (A_3,A_5) = (5,5)$: the average is $5$, and the score is $0$. - $x = (A_1,A_3,A_4,A_5) = (2,5,7,5)$: the average is $\frac{19}{4}$, and the score is $3$. - $x = (A_1,A_2,A_3,A_4,A_5) = (2,6,5,7,5)$: the average is $5$, and the score is $2$.
题目信息
题号
arc197_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。