Ehab Fails to Be Thanos
题意翻译
## 题意
你被给予了一个长度为 $2n$ 的序列 $a$.
试问:是否存在重排方法,前 $n$ 个元素的和不等于后 $n$ 个元素的和?
## 输入
第一行一个整数 $n(1\le n\le 1000)$
接下来一行 $n$ 个数 $a_1,a_2,\cdots,a_{2n}(1\le a_i\le 10^6)$
## 输出
如果存在重排方法,你应该输出 $2n$ 个数,是这个方法。
否则,输出 ``-1``.
## 说明
在第一个样例中,前 $n$ 个数的和为 $2+1+3=6$,而后 $n$ 个数的和为 $1+1+2=4$,这达到了目的:前 $n$ 个元素的和不等于后 $n$ 个元素的和。
题目描述
You're given an array $ a $ of length $ 2n $ . Is it possible to reorder it in such way so that the sum of the first $ n $ elements isn't equal to the sum of the last $ n $ elements?
输入输出格式
输入格式
The first line contains an integer $ n $ ( $ 1 \le n \le 1000 $ ), where $ 2n $ is the number of elements in the array $ a $ .
The second line contains $ 2n $ space-separated integers $ a_1 $ , $ a_2 $ , $ \ldots $ , $ a_{2n} $ ( $ 1 \le a_i \le 10^6 $ ) — the elements of the array $ a $ .
输出格式
If there's no solution, print "-1" (without quotes). Otherwise, print a single line containing $ 2n $ space-separated integers. They must form a reordering of $ a $ . You are allowed to not change the order.
输入输出样例
输入样例 #1
3
1 2 2 1 3 1
输出样例 #1
2 1 3 1 1 2
输入样例 #2
1
1 1
输出样例 #2
-1
说明
In the first example, the first $ n $ elements have sum $ 2+1+3=6 $ while the last $ n $ elements have sum $ 1+1+2=4 $ . The sums aren't equal.
In the second example, there's no solution.