gahui and sousenkyo 6

면접 대비

시간 제한1.5초메모리 제한512 MB

요약
n과 x가 주어질 때, 서로 다른 n개의 양의 정수이면서 비트 XOR 값이 x인 수열을 출력한다.
난이도

보통10점 중 6점

유형
비트 연산, 수학, 구현, 그리디
정답자
아직 제출이 없습니다

문제

Gahui is watching the annual character election. After the election, The top 16 characters receive enormous benefits for one year. For that reason, fans vote passionately to get their favorite characters into the top 16. Remarkably, at least one Cinderella appears in every election, achieving an outstanding outcome.

Gahui missed the broadcast of the fascinating character election. On the Internet, there was only the following information:

  • The number of characters participating in the election is nn.
  • No two characters have the same number of votes, and each character has received at least one vote.
  • When the bitwise-xor operation is applied to the votes of all characters, the result is xx.
  • The number of votes for every character is less than 2632^{63}.

Find character election results.

입력

nn and xx are given, separated by spaces.

출력

Print nn in the first line. nn is the number of characters participating in the election.

In the following nn lines, print the number of votes obtained by rank.

If there are multiple solutions, you may output any of them.

제한

  • 4≤n≤1064 \le n \le 10^6
  • 0≤x≤2300 \le x \le 2^{30}

예제1

  1. 예제 1

    입력
    4 3112
    
    예상 출력
    4
    45000
    43000
    40000
    39000