has n squares of stature h1,h2,… ,hn, and everything howdy don't surpass some worth x. He intends to stack all n blocks into m separate pinnacles. The tallness of a pinnacle is essentially the amount of the statures of its squares. For the pinnacles to look lovely, no two pinnacles might have a tallness distinction of stringently more
Correct answer will be upvoted else downvoted.
Phoenix has n squares of stature h1,h2,… ,hn, and everything howdy don't surpass some worth x. He intends to stack all n blocks into m separate pinnacles. The tallness of a pinnacle is essentially the amount of the statures of its squares. For the pinnacles to look lovely, no two pinnacles might have a tallness distinction of stringently more than x.
Kindly assist Phoenix with building m pinnacles that look excellent. Each pinnacle should have somewhere around one square and all squares should be utilized.
Input
The input comprises of numerous experiments. The principal line contains an integer t (1≤t≤1000) — the number of experiments.
The primary line of each experiment contains three integers n, m, and x (1≤m≤n≤105; 1≤x≤104) — the number of squares, the number of pinnacles to fabricate, and the greatest OK tallness distinction of any two pinnacles, separately.
The second line of each experiment contains n space-isolated integers (1≤hi≤x) — the statures of the squares.
It is ensured that the amount of n over all the experiments won't surpass 105.
Output
For each experiment, if Phoenix can't fabricate m pinnacles that look excellent, print NO. In any case, print YES, trailed by n integers y1,y2,… ,yn, where yi (1≤yi≤m) is the list of the pinnacle that the I-th block is put in.
Step by step
Solved in 3 steps with 1 images