BPC 1 S1 - Homework Questions

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 256M

Problem type

Your teacher wrote a sequence of N distinct integers on the board, the homework questions you are supposed to solve for the next class. The i^\text{th} of these integers is a_i. However, while your teacher wasn't looking, your mischievous friend erased all N numbers and replaced them with a new sequence consisting of the sum of every ordered pair of elements in the original sequence. The i^\text{th} integer in the new sequence is b_i. As a good student, you would like to do your homework questions. Write a program that, given the modified sequence, recovers the initial sequence.


1 \le N \le 100

1 \le a_i, b_i \le 10^9

Subtask 1 [10%]

N = 2

Subtask 2 [10%]

N = 3

Subtask 3 [80%]

No additional constraints.

Input Specification

The first line contains a single integer, N, the length of the initial sequence.

The second line contains N^2 integers, b_i, the elements of the modified sequence.

Output Specification

Output a single line containing N space-separated integers, the initial sequence.

You should output the integers in increasing order.

If there are several solutions, you may output any one of them.

Sample Input

5 4 5 6

Sample Output

2 3


There are no comments at the moment.