Table Tennis

Time limit: 1.5s Memory limit: 64MB Input: Output:

Task

In Little Square’s class everyone is obsessed with table tennis. Each person has a distinct non-negative integer score that represents their table tennis skill. His class has NN people, and is perfectly balanced with respect to table tennis skill. This means that we can form N2\frac{N}{2} teams of two such that the total table tennis skill of each team is equal. Note that this means that NN is even.

Unfortunately, KK people from Little Triangle’s class have snuck into Little Square’s classroom. Now there are N+KN + K people in the classroom, each of which has a distinct, non-negative, integer table tennis skill score. Choose NN people from among these such that the resulting group is perfectly balanced with respect to table tennis skill.

Input data

On the first line of the input you will find NN and KK. On the next line of the input you will find N+KN + K non-negative, distinct integers, in increasing order. These represent the table tennis skill scores of the people in the classroom, after those Little Triangle’s class snuck in.

Output data

Output one line, containing NN non-negative, distinct integers, in increasing order. The outputs should be a subset of the table tennis skill scores of the people in the classroom, and should be perfectly balanced. If there are multiple solutions, any one is accepted.

Constraints and clarifications

  • 1N150 0001 \leq N \leq 150 \ 000
  • 1K4001 \leq K \leq 400
  • 11 \leq table tennis skill score 1 000 000 000\leq 1 \ 000 \ 000 \ 000
# Points Restrictions
1 11 1N2 0001 \leq N \leq 2 \ 000, K=1K = 1
2 9 K=1K = 1
3 14 K=2K = 2
4 15 1N, K1001 \leq N,\ K \leq 100
5 9 N+K18N + K \leq 18
6 14 1N2 0001 \leq N \leq 2 \ 000, 1K201 \leq K \leq 20
7 15 1K201 \leq K \leq 20
8 13 No additional constraints

Example 1

stdin

4 3
1 2 3 4 8 10 20

stdout

1 2 3 4

Example 2

stdin

4 2
1 2 3 4 5 6

stdout

1 2 3 4

Explanation

In both examples, the output is correct since it has 44 elements, is a subset of the input, and since we can form teams of two of equal table tennis skill (one team with skills 11 and 44, and one team with skills 22 and 33).

In the first example, it would also be correct to output 1, 3, 8, 101,\ 3,\ 8,\ 10 or 2, 4, 8, 102,\ 4,\ 8,\ 10.

In the the second example, it would also be correct to output 2, 3, 4, 52,\ 3,\ 4,\ 5 or 3, 4, 5, 63,\ 4,\ 5,\ 6.

Log in or sign up to be able to send submissions!