QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 2048 MB

#22847. Find Iotas

Statistics

You are given a positive integer $N$ and a nonnegative integer $X$.

Determine whether there exists a sequence $A = (A_1, A_2, \dots, 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, \dots, 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 < i_2 < \dots < i_N \le 2N$ such that $A_{i_j} = j$ $(1 \le j \le N)$.

If such a sequence exists, output one. If multiple such sequences exist, output any one of them.

Input

The input consists of multiple test cases in the following format.

$$ \begin{aligned} &T \\ &\mathrm{case}_1 \\ &\mathrm{case}_2 \\ &\vdots \\ &\mathrm{case}_T \end{aligned} $$

Each test case is given in the following format.

$$ 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

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, \dots, A_{2N}$ representing a sequence satisfying the conditions on the second line.

If there are multiple valid sequences, you may output any of them.

Example

Input 1

3
2 3
50 1000000000000000000
4 0

Output 1

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

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.