Codeforces Round 1087 (Div. 2)
B
Array
Codeforces
900
原题
← AC →
翻译中…

You are given an integer array $a$ of length $n$.

翻译中…

For each index $i$, find the maximum number of indices $j$ such that $j \gt i$ and $|a_i - k| \gt |a_j - k|$, over all possible integer values of $k$.

翻译中…

Input

翻译中…

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 100$). The description of the test cases follows.

翻译中…

The first line of each test case contains an integer $n$ ($1 \le n \le 5000$).

翻译中…

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($-10^9 \le a_i \le 10^9$).

翻译中…

It is guaranteed that the sum of $n$ over all test cases does not exceed $5000$.

翻译中…

Output

翻译中…

For each test case, output $n$ integers denoting the answer.

翻译中…

Note

翻译中…

In the second test, the answers are:

翻译中…
  • For $i=1$, you can choose $k=-195$, then $j=2$.
  • For $i=2$, you can choose $k=5$, there exists no index $j \gt i$.
翻译中…

In the third test, the answers are:

翻译中…
  • For $i=1$, you can choose $k=195$, then $j=2,3,4,5$.
  • For $i=2$, you can choose $k=78$, then $j=3,4$.
  • For $i=3$, you can choose $k=15$, then $j=4,5$.
  • For $i=4$, you can choose $k=15$, then $j=5$.
  • For $i=5$, you can choose $k=998\,244\,353$, there exists no index $j \gt i$.
翻译中…

样例

Input #1
6
1
1092
2
105 -105
5
1 2 93 84 2
7
2 9 38 4 7 1 6
10
1 9 20 9 829 3 87 1 283 7
11
9 18 29817 283 3 3928 5726 1942 1000000000 -1000000000 19
Output #1
0
1 0
4 2 2 1 0
5 4 4 2 2 1 0
8 4 4 3 5 3 2 2 1 0
8 7 7 4 5 3 3 2 2 1 0
InputCopy OutputCopy
题目信息
题号
2209B
时间限制
1.5 s
内存限制
256 MB
标签
贪心

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