Minions and Voting

All submissions for this problem are available.
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
There are N minions who are competing in an election of the president of the ACM (Association of Cute Minions). They are standing in a line in the order from minion 1 to minion N. For each i (1 ≤ i ≤ N), the ith minion has an influence level of S_{i}.
A single minion may cast any number of votes. Minion j will vote for minion i (i ≠ j) if and only if the influence level of the jth minion is greater than or equal to the sum of influence levels of all the minions standing between them (excluding the ith and jth minion).
Your task is to find the number of votes received by each minion.
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 denoting the number of minions.
 The second line contains N spaceseparated integers S_{1}, S_{2}, ..., S_{N}.
Output
For each test case, print a single line containing N spaceseparated integers. For each valid i, the ith of these integers should denote the number of votes the ith minion will get.
Constraints
 1 ≤ T ≤ 10^{5}
 1 ≤ N ≤ 10^{5}
 1 ≤ S_{i} ≤ 10^{9} for each valid i
 sum of N over all test cases won't exceed 10^{6}
Subtasks
Subtask #1 (30 points):
 1 ≤ N ≤ 500
 sum of N over all test cases won't exceed 10,000
Subtask #2 (70 points): original constraints
Example
Input: 2 4 4 3 2 1 5 1 2 2 3 1 Output: 1 2 3 2 2 3 2 3 1
Explanation
Example case 1:
 The first minion will get only a vote of the second minion.
 The second minion will get votes of the first and third minion.
 The third minion will get votes of the first, second and fourth minion.
 The fourth minion will get votes of the second and third minion.
Author:  admin2 
Editorial  https://discuss.codechef.com/problems/MINVOTE 
Tags  admin2, binarysearch, easymedium, march18 
Date Added:  28022018 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, kotlin, PERL6, TEXT, SCM chicken, CLOJ, COB, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions