are given a number n and an exhibit b1,b2,… ,bn+2, acquired by the accompanying calculation: some exhibit a1,a2,… ,a was speculated; cluster a was composed to exhibit b, for example bi=ai (1≤i≤n); The (n+1)- th component of the cluster b is the amount of the numbers in the exhibit a,
Correct answer will be upvoted else downvoted. Computer science.
You are given a number n and an exhibit b1,b2,… ,bn+2, acquired by the accompanying calculation:
some exhibit a1,a2,… ,a was speculated;
cluster a was composed to exhibit b, for example bi=
The (n+1)- th component of the cluster b is the amount of the numbers in the exhibit a, for example bn+1=a1+a2+… +an;
The (n+2)- th component of the cluster b was thought of some number x (1≤x≤109), for example bn+2=x; The
cluster b was rearranged.
For instance, the cluster b=[2,3,7,12,2] it very well may be acquired in the accompanying ways:
a=[2,2,3] and x=12;
a=[3,2,7] and x=2.
For the given cluster b, find any exhibit a that might have been speculated at first.
Input
The main line contains a solitary integer t (1≤t≤104). Then, at that point, t experiments follow.
The primary line of each experiment contains a solitary integer n (1≤n≤2⋅105).
The second column of each experiment contains n+2 integers b1,b2,… ,bn+2 (1≤bi≤109).
It is ensured that the amount of n over all experiments doesn't surpass 2⋅105.
Output
For each experiment, output:
"- 1", if the cluster b couldn't be gotten from any exhibit a;
n integers a1,a2,… ,an, in any case.
Step by step
Solved in 3 steps with 1 images