#P1243. 排序集合

排序集合

Description

For subsets of N={1,2,,n}N=\{1,2,\cdots,n\}, define a relation called "less than":

Let S1={X1,X2,,Xi}S1=\{X_1,X_2,\cdots,X_i\}, (X1<X2<<Xi)(X_1<X_2<\cdots<X_i), S2={Y1,Y2,,Yj}S2=\{Y_1,Y_2,\cdots,Y_j\}, (Y1<Y2<<Yj)(Y_1<Y_2<\cdots<Y_j). If there exists a kk, (0kmin(i,j))(0\leq k\leq\min(i,j)), such that X1=Y1,,Xk=YkX_1=Y_1,\cdots,X_k=Y_k, and k=ik=i or Xk+1<Yk+1X_{k+1}<Y_{k+1}, then S1S1 is said to be "less than" S2S2.

Your task is, for any nn (n31)(n\leq31) and kk (k<2n)(k<2^n), to find the kk-th smallest subset.

Input Format

The input file contains a single line with two natural numbers, nn and kk, separated by a space.

Output Format

Output a single line listing the elements of the subset in increasing order. Output 00 for the empty set.

3 4

1 2 3

Hint

Translated by ChatGPT 5