시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB5011310.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.

제한

  • 1 ≤ N ≤ 150,000
  • 1 ≤ K ≤ 400
  • 1 ≤ table tennis skill score ≤ 1,000,000,000

서브태스크 1 (11점)

  • 1 ≤ N ≤ 2,000
  • K = 1

서브태스크 2 (9점)

  • 1 ≤ N ≤ 150,000
  • K = 1

서브태스크 3 (14점)

  • 1 ≤ N ≤ 150,000
  • K = 1​​​​​​2

서브태스크 4 (15점)

  • 1 ≤ N ≤ 100
  • 1 ≤ K ≤ 100

서브태스크 5 (9점)

  • N + K ≤ 18

서브태스크 6 (14점)

  • 1 ≤ N ≤ 2,000
  • 1 ≤ K ≤ 20

서브태스크 7 (15점)

  • 1 ≤ N ≤ 150,000
  • 1 ≤ K ≤ 20

서브태스크 8 (13점)

  • No additional constraints.

예제 입력 1

4 3
1 2 3 4 8 10 20

예제 출력 1

1 2 3 4

예제 입력 2

4 2
1 2 3 4 5 6

예제 출력 2

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번

  • 데이터를 추가한 사람: koosaga

채점 및 기타 정보

  • 예제는 채점하지 않는다.