CF1726B.Mainak and Interesting Sequence

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Mainak has two positive integers nn and mm .

Mainak finds a sequence a1,a2,,ana_1, a_2, \ldots, a_n of nn positive integers interesting, if for all integers ii ( 1in1 \le i \le n ), the bitwise XOR of all elements in aa which are strictly less than aia_i is 00 . Formally if pip_i is the bitwise XOR of all elements in aa which are strictly less than aia_i , then aa is an interesting sequence if p1=p2==pn=0p_1 = p_2 = \ldots = p_n = 0 .

For example, sequences [1,3,2,3,1,2,3][1,3,2,3,1,2,3] , [4,4,4,4][4,4,4,4] , [25][25] are interesting, whereas [1,2,3,4][1,2,3,4] ( p2=10p_2 = 1 \ne 0 ), [4,1,1,2,4][4,1,1,2,4] ( p1=112=20p_1 = 1 \oplus 1 \oplus 2 = 2 \ne 0 ), [29,30,30][29,30,30] ( p2=290p_2 = 29 \ne 0 ) aren't interesting.

Here aba \oplus b denotes bitwise XOR of integers aa and bb .

Find any interesting sequence a1,a2,,ana_1, a_2, \ldots, a_n (or report that there exists no such sequence) such that the sum of the elements in the sequence aa is equal to mm , i.e. a1+a2+an=ma_1 + a_2 \ldots + a_n = m .

As a reminder, the bitwise XOR of an empty sequence is considered to be 00 .

输入格式

Each test contains multiple test cases. The first line contains a single integer tt ( 1t1051 \le t \le 10^5 ) — the number of test cases. Description of the test cases follows.

The first line and the only line of each test case contains two integers nn and mm ( 1n1051 \le n \le 10^5 , 1m1091 \le m \le 10^9 ) — the length of the sequence and the sum of the elements.

It is guaranteed that the sum of nn over all test cases does not exceed 10510^5 .

输出格式

For each test case, if there exists some interesting sequence, output "Yes" on the first line, otherwise output "No". You may print each letter in any case (for example, "YES", "Yes", "yes", "yEs" will all be recognized as positive answer).

If the answer is "Yes", output nn positive integers a1,a2,,ana_1, a_2, \ldots, a_n ( ai1a_i \ge 1 ), forming an interesting sequence such that a1+a2+an=ma_1 + a_2 \ldots + a_n = m . If there are multiple solutions, output any.

输入输出样例

  • 输入#1

    4
    1 3
    6 12
    2 1
    3 6

    输出#1

    Yes
    3
    Yes
    1 3 2 2 3 1
    No
    Yes
    2 2 2

说明/提示

  • In the first test case, [3][3] is the only interesting sequence of length 11 having sum 33 .
  • In the third test case, there is no sequence of length 22 having sum of elements equal to 11 , so there is no such interesting sequence.
  • In the fourth test case, p1=p2=p3=0p_1 = p_2 = p_3 = 0 , because bitwise XOR of an empty sequence is 00 .
首页