BPC 1 S1 - Homework Questions

View as PDF

Submit solution


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

Author:
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 ith of these integers is ai. 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 ith integer in the new sequence is bi. As a good student, you would like to do your homework questions. Write a program that, given the modified sequence, recovers the initial sequence.

Constraints

1N100

1ai,bi109

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 N2 integers, bi, 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

Copy
2
5 4 5 6

Sample Output

Copy
2 3

Comments

There are no comments at the moment.