Necklaces
ID: 1145
Description
While on an expedition among some ancient ruins, archaeologists discovered some mysterious necklaces. After much observation, they found out that necklaces shared some common characteristics. All necklaces are composed of the same number of pearls. These pearls are spherical, and are arranged in order of increasing radius. When the pearls are numbered from smallest to biggest, the archaeologists discovered that the ith pearl has radius no greater than 2i. Although lost among the four corners of the world, scientists are sure that all possible combinations of necklaces were made.

Archaeologists later made another interesting discovery: they managed to translate the ancient number system to our current decimal one, also establishing that a number x may have special properties that correlate it to the necklaces. A Vietnamese explorer thinks that, when all necklaces are arranged in lexicographical order, the xth one holds the answer to a great secret. Your task is to find such necklace.
Input
The number of pearls in each necklace, 1 ≤ n ≤ 256, followed by a positive integer, x, which may be larger than 264.
Output
A single line containing n integers, separated by one space, where the ith integer is the radius of the pearl in position i of the xth necklace.
Sample Test Cases
InputExpected Output
1
1
1
2
4
2 3
Statistics
The Tops
No Submissions