|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|3 초||512 MB||50||11||3||10.000%|
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 N people, and is perfectly balanced with respect to table tennis skill. This means that we can form N/2 teams of two such that the total table tennis skill of each team is equal. Note that this means that N is even.
Unfortunately, K people from Little Triangle’s class have snuck into Little Square’s classroom. Now there are N + K people in the classroom, each of which has a distinct, non-negative, integer table tennis skill score. Choose N people from among these such that the resulting group is perfectly balanced with respect to table tennis skill.
On the first line of the input you will find N and K. On the next line of the input you will find N + 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 one line, containing N 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.
4 3 1 2 3 4 8 10 20
1 2 3 4
4 2 1 2 3 4 5 6
1 2 3 4
In both examples, the output is correct since it has 4 elements, is a subset of the input, and since we can form teams of two of equal table tennis skill (one team with skills 1 and 4, and one team with skills 2 and 3).
In the first example, it would also be correct to output 1, 3, 8, 10 or 2, 4, 8, 10.
In the second example, it would also be correct to output 2, 3, 4, 5 or 3, 4, 5, 6.
Contest > infO(1) Cup > infO(1) Cup 2020 1번