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,

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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=ai (1≤i≤n); 

 

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.

 

 

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Inference
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education