Logo
(追記) (追記ここまで)

25672번 - Even and Odd Combinations 다국어투 스텝

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB31716914161.304%

문제

Let a $k$-combination out of $n$ be a $k$-element subset of the $n$-element set $\{1, 2, \ldots, n\}$. To denote a combination, list its elements in ascending order. For example, 2ドル$-combinations out of 3ドル$ look as follows: $\{1, 2\},ドル $\{1, 3\},ドル $\{2, 3\}$.

Let a combination be even if the number of its elements is an even number, and odd otherwise. For a fixed $n > 0,ドル consider two sets: $A_n,ドル the set of all even combinations out of $n,ドル and $B_n,ドル the set of all odd combinations out of $n$. It can be shown that $A_n$ and $B_n$ contain the same number of combinations.

For each $n = 1, 2, \ldots, 50,ドル your task is as follows. Construct any bijection (a one-to-one correspondence) between the sets $A_n$ and $B_n$. After that, given an element of one of these sets, print the corresponding element of the other set.

입력

출력

제한

인터랙션

To check that you indeed constructed a bijection, in this problem, your solution will be run twice on each test. Each line of input is terminated by an end-of-line character.

첫 번째 실행

During the first run, the first line contains an integer $t,ドル the number of test cases (1ドル \le t \le 1000$). Then follow their descriptions.

Each test case denotes a combination and is given on two input lines. The first of these lines contains two space-separated integers $n$ and $k$ (1ドル \le n \le 50,ドル 0ドル \le k \le n$). The second one contains $k$ space-separated integers $a_1, a_2, \ldots, a_k,ドル the elements of the combination (1ドル \le a_1 < a_2 < \ldots < a_k \le n$). If $k = 0,ドル the second line is empty.

For each test case, print the corresponding combination from the other set. Output format for combinations is exactly the same as input format. The printed combination must have the same $n$ as the given one, and $k$ must have different parity. There are no other restrictions on the correspondence.

두 번째 실행

During the second run, the input format is exactly the same as during the first run. However, in each test case, the given combination is not the initial one, but instead the one printed during the first run.

For each test case, as during the first run, print the corresponding combination from the other set. Output format for combinations is exactly the same as input format. As the correspondence must be a bijection, the combination printed during the second run must be the same as the one given during the first run. This is what the jury program will check.

예제

For each test, the input during the second run depends on the solution's output during the first run.

Below we show two runs of a certain solution on the first test.

예제 입력 1

6
3 0
2 1
1
3 3
1 2 3
3 1
1
3 1
2
3 1
3

예제 출력 1

3 3
1 2 3
2 2
1 2
3 0
3 2
2 3
3 2
1 3
3 2
1 2

예제 입력 2

6
3 3
1 2 3
2 2
1 2
3 0
3 2
2 3
3 2
1 3
3 2
1 2

예제 출력 2

3 0
2 1
1
3 3
1 2 3
3 1
1
3 1
2
3 1
3

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2022 > Day 4: Ivan Kazmenko Contest 3 B번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /