아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Even and Odd Combinations

시간 제한2초메모리 제한1024 MB

요약
n이 1부터 50일 때 짝수 크기 부분집합과 홀수 크기 부분집합 사이의 전단사 함수를 만들고, 주어진 부분집합에 대응하는 부분집합을 출력한다.
난이도

보통10점 중 7점

유형
조합론, 수학, 비트 연산, 구현
정답자
아직 제출이 없습니다

문제

Let a kk-combination out of nn be a kk-element subset of the nn-element set 1,2,…,n\\{1, 2, \ldots, n\\}. To denote a combination, list its elements in ascending order. For example, 22-combinations out of 33 look as follows: 1,2\\{1, 2\\}, 1,3\\{1, 3\\}, 2,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>0n > 0, consider two sets: A_nA\_n, the set of all even combinations out of nn, and B_nB\_n, the set of all odd combinations out of nn. It can be shown that A_nA\_n and B_nB\_n contain the same number of combinations.

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

예제2

  1. 예제 1

    입력
    6
    3 0
    
    2 1
    1
    3 3
    1 2 3
    3 1
    1
    3 1
    2
    3 1
    3
    
    예상 출력
    3 3
    1 2 3
    2 2
    1 2
    3 0
    
    3 2
    2 3
    3 2
    1 3
    3 2
    1 2
    
  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
    
    예상 출력
    3 0
    
    2 1
    1
    3 3
    1 2 3
    3 1
    1
    3 1
    2
    3 1
    3