#P17532. [JAG 2026 Summer Camp #1] Find Iotas
[JAG 2026 Summer Camp #1] Find Iotas
Problem Description
You are given a positive integer and a nonnegative integer .
Determine whether there exists a sequence of length satisfying all of the following conditions.
- Each integer from to appears in exactly twice.
- The sequence occurs exactly times as a subsequence of . In other words, there are exactly ways to choose indices such that ().
If such a sequence exists, output one. If multiple such sequences exist, output any one of them.
Input Format
The input consists of multiple test cases in the following format.
T
case_1
case_2
...
case_T
Each test case is given in the following format.
N X
The first line contains an integer (), the number of test cases.
For each test case, you are given a positive integer () and a nonnegative integer ().
The sum of over all test cases does not exceed .
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 integers representing a sequence satisfying the conditions on the second line.
If there are multiple valid sequences, you may output any of them.
3
2 3
50 1000000000000000000
4 0
Yes
1 2 1 2
No
Yes
4 4 3 3 2 2 1 1