AtCoder Regular Contest 200 (Div. 2)
D
|A + A|
AtCoder
⌀ 2474
原题
← CE →
翻译中…

Problem Statement

翻译中…

You are given positive integers $M,K$.

翻译中…

Determine whether there exist a positive integer $N$ and an integer sequence $A=(A_1,A_2,\ldots, A_N)$ that satisfy all the following conditions, and if they exist, find one.

翻译中…
  • $1\le N\le M$
  • $0\le A_i < M$ $(1\le i\le N)$
  • There are exactly $K$ integers $0\le k < M$ such that there exists a pair of indices $(i,j)$ satisfying $k\equiv A_i+A_j \pmod M$.
翻译中…

You are given $T$ test cases, so find the answer for each.

翻译中…

Constraints

翻译中…
  • $1\le T\le 2\times 10^5$
  • $1\le K\le M\le 2\times 10^5$
  • The sum of $M$ over all test cases is at most $2\times 10^5$.
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\text{case}_1
\text{case}_2
\vdots
\text{case}_T

翻译中…

Each test case is given in the following format:

翻译中…

M K

翻译中…

Output

翻译中…

Output your solutions for the test cases in order, separated by newlines.

翻译中…

For each test case, if there are no $N,A$ that satisfy all conditions, output No.

翻译中…

Otherwise, output $N$ and $A$ that satisfy all conditions in the following format:

翻译中…

Yes
N
A_1 A_2 \ldots A_N

翻译中…

If there are multiple $N$ and $A$ that satisfy the conditions, you may output any of them.

翻译中…

样例

Input #1
3
6 5
3 2
8 3
Output #1
Yes
3
3 1 4
No
Yes
2
0 1
For the first test case, if we set $A=(3,1,4)$, then - $k=0$: Setting $(i,j)=(1,1)$, we have $0\equiv 3+3\pmod 6$. - $k=1$: Setting $(i,j)=(1,3)$, we have $1\equiv 3+4\pmod 6$. - $k=2$: Setting $(i,j)=(3,3)$, we have $2\equiv 4+4\pmod 6$. - $k=3$: There is no pair of indices $(i,j)$ that satisfies the condition. - $k=4$: Setting $(i,j)=(1,2)$, we have $4\equiv 3+1\pmod 6$. - $k=5$: Setting $(i,j)=(2,3)$, we have $5\equiv 1+4\pmod 6$. Thus, there are exactly $5$ values of $0\le k < 6$ that satisfy the condition.
题目信息
题号
arc200_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。