P17532 [JAG 2026 Summer Camp #1] Find Iotas

Description

You are given a positive integer $N$ and a nonnegative integer $X$. Determine whether there exists a sequence $A=(A_1,A_2,\ldots,A_{2N})$ of length $2N$ satisfying all of the following conditions. - Each integer from $1$ to $N$ appears in $A$ exactly twice. - The sequence $(1,2,\ldots,N)$ occurs exactly $X$ times as a subsequence of $A$. In other words, there are exactly $X$ ways to choose indices $1\le i_1

Input Format

The input consists of multiple test cases in the following format. ```text T case_1 case_2 ... case_T ``` Each test case is given in the following format. ```text N X ``` The first line contains an integer $T$ ($1\le T\le 2\times 10^5$), the number of test cases. For each test case, you are given a positive integer $N$ ($1\le N\le 2\times 10^5$) and a nonnegative integer $X$ ($0\le X\le 10^{18}$). The sum of $N$ over all test cases does not exceed $2\times 10^5$.

Output Format

For each test case, if there is no sequence satisfying the conditions, print `No` on a single line. Otherwise, print `Yes` on the first line, and print $2N$ integers $A_1,A_2,\ldots,A_{2N}$ representing a sequence satisfying the conditions on the second line. If there are multiple valid sequences, you may output any of them.