410314: GYM104008 K Barrel Theory

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

K. Barrel Theorytime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output

Chinese children have more or less heard of the word "barrel theory" — the barrel's capacity is determined not by the longest wooden bars but by the shortest, as illustrated below.

Teachers and parents prefer to use this theory to tell the importance of all-round development, quality education, or collectivism. However, Little Desprado2 and Foolish Timsei disagree with this theory. In their opinion, a good barrel depends not only on large capacity but also on attractive looking.

According to barrel theory, if a barrel consists of $$$n$$$ wooden bars of with positive integral length $$$a_1,\ a_2,\ ...,\ a_n$$$ , the capacity of the barrel is $$$\min_{i=1}^n a_i$$$. They define the ugliness of the barrel is $$$a_1 \oplus a_2 \oplus ... \oplus a_n$$$. Here $$$\oplus$$$ denotes bitwise XOR (exclusive-or). They consider a barrel good if and only if its ugliness is less than its capacity.

Now Foolish Timsei and Little Desprado2 have a long wooden bar of length $$$m$$$, and they want to cut it into an $$$n$$$-pieces good barrel while the total length remains unchanged. Help them find a good scheme!

Input

The first line contains one integer $$$T$$$ ($$$1\le T\le 10^5$$$), denoting the test cases.

Each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1\le n\le 10^5,~ n\le m\le10^7$$$) in a single line, denoting the number of wooden bars after cutting and the length of the initial wooden bar.

It is guaranteed that sum of $$$n$$$ over all test cases is not greater than $$$3\times 10^5$$$; the sum of $$$m$$$ over all test cases is not greater than $$$10^7$$$.

Output

For each test case,

  • If a cutting scheme exists, print "YES" in one line, followed by a line of $$$n$$$ integers $$$a_1,\ a_2,\ ...,\ a_n$$$ separated by spaces as the lengths of the $$$n$$$ wooden bars. If there are multiple solutions, print any.
  • Otherwise, print "NO" in one line.
ExampleInput
3
6 7
5 17
4 4
Output
NO
YES
2 2 2 4 7
YES
1 1 1 1

加入题单

算法标签: