5541: Pty loves sequence
内存限制:512 MB
时间限制:6.000 S
评测方式:文本比较
命题人:
提交:1
解决:1
题目描述
输入
The first line contains a single integer T(1 ≤ T ≤ 10) — the number of test cases.
For each test case, only one line contains two integers n, p (1 ≤ n ≤ 3000, 1 ≤ p ≤ 10e9 ).
For each test case, only one line contains two integers n, p (1 ≤ n ≤ 3000, 1 ≤ p ≤ 10e9 ).
输出
For each test case, output two lines.
The first line contains a integer - the number of good suquences modulo p. The second line contains n integers separated by spaces - The x-th integer represent the occurrence number of x in all good sequences modulo p.
The first line contains a integer - the number of good suquences modulo p. The second line contains n integers separated by spaces - The x-th integer represent the occurrence number of x in all good sequences modulo p.
样例输入 复制
2
3 3
3 1216
样例输出 复制
0
1 1 1
6
10 7 1