strange deformity: if the absolute weight on it is by and large x, it will detonate. Would he be able to put all n gold pieces onto the scale in some request, without the scale detonating during the interaction? Provided that this is true, assist him with tracking down some conceivable request. Officially, rework the exhibit w so that for every I (1≤i≤n), ∑j=1iwj
Computer science. Correct answer will be upvoted else downvoted.
scale has a strange deformity: if the absolute weight on it is by and large x, it will detonate. Would he be able to put all n gold pieces onto the scale in some request, without the scale detonating during the interaction? Provided that this is true, assist him with tracking down some conceivable request.
Officially, rework the exhibit w so that for every I (1≤i≤n), ∑j=1iwj≠x.
Input
The input comprises of various experiments. The primary line contains an integer t (1≤t≤1000) — the number of experiments.
The primary line of each experiment contains two integers n and x (1≤n≤100; 1≤x≤104) — the number of gold pieces that Phoenix has and the load to keep away from, individually.
The second line of each experiment contains n space-isolated integers (1≤wi≤100) — the loads of the gold pieces. It is ensured that the loads are pairwise unmistakable.
Output
For each experiment, if Phoenix can't put all n pieces without the scale detonating, print NO. In any case, print YES followed by the adjusted exhibit w. In case there are numerous arrangements, print any.
Step by step
Solved in 3 steps with 1 images