Codeforces Round 457 (Div. 2)
B
Jamie and Binary Sequence (changed after round)
Codeforces
2000
原题
← AC →
翻译中…

Jamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem:

翻译中…

Find $*k*$ integers such that the sum of two to the power of each number equals to the number $*n*$ and the largest integer in the answer is as small as possible. As there may be multiple answers, you are asked to output the lexicographically largest one.

翻译中…

To be more clear, consider all integer sequence with length $*k*$ $(*a*_{1}, *a*_{2}, ..., *a*_{*k*})$ with image. Give a value image to each sequence. Among all sequence(s) that have the minimum $*y*$ value, output the one that is the lexicographically largest.

翻译中…

For definitions of powers and lexicographical order see notes.

翻译中…

Input

翻译中…

The first line consists of two integers $*n*$ and $*k*$ ($1 ≤ *n* ≤ 10^{18}, 1 ≤ *k* ≤ 10^{5})$ — the required sum and the length of the sequence.

翻译中…

Output

翻译中…

Output "No" (without quotes) in a single line if there does not exist such sequence. Otherwise, output "Yes" (without quotes) in the first line, and $*k*$ numbers separated by space in the second line — the required sequence.

翻译中…

It is guaranteed that the integers in the answer sequence fit the range $[ - 10^{18}, 10^{18}]$.

翻译中…

Note

翻译中…

Sample 1:

翻译中…

$2^{3} + 2^{3} + 2^{2} + 2^{1} + 2^{0} = 8 + 8 + 4 + 2 + 1 = 23$

翻译中…

Answers like $(3, 3, 2, 0, 1)$ or $(0, 1, 2, 3, 3)$ are not lexicographically largest.

翻译中…

Answers like $(4, 1, 1, 1, 0)$ do not have the minimum $*y*$ value.

翻译中…

Sample 2:

翻译中…

It can be shown there does not exist a sequence with length 2.

翻译中…

Sample 3:

翻译中…

image

翻译中…

Powers of 2:

翻译中…

If $*x* > 0$, then $2^{*x*} = 2·2·2·...·2$ ($*x*$ times).

翻译中…

If $*x* = 0$, then $2^{*x*} = 1$.

翻译中…

If $*x* < 0$, then image.

翻译中…

Lexicographical order:

翻译中…

Given two different sequences of the same length, $(*a*_{1}, *a*_{2}, ... , *a*_{*k*})$ and $(*b*_{1}, *b*_{2}, ... , *b*_{*k*})$, the first one is smaller than the second one for the lexicographical order, if and only if $*a*_{*i*} < *b*_{*i*}$, for the first $*i*$ where $*a*_{*i*}$ and $*b*_{*i*}$ differ.

翻译中…

样例

Input #1
23 5
Output #1
Yes
3 3 2 1 0
InputCopy OutputCopy
Input #2
13 2
Output #2
No
InputCopy OutputCopy
Input #3
1 2
Output #3
Yes
-1 -1
InputCopy OutputCopy
题目信息
题号
916B
时间限制
2 s
内存限制
256 MB
标签
位运算
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。