8534: Count Set

内存限制:128 MB 时间限制:15 S
题面:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

Given a permutation p of 1,2,,n and a non-negative integer k. Please calculate the number of subsets T1,2,3,4,...nsatisfying |T|=k and P(T)T=0.

Where P(T)means P(T)={yy=px,xT}.

输入格式

Each test contains multiple test cases. The first line contains the number of test cases (1T15). Description of the test cases follows.

The first line contains two separated integers nk.

The second line contains n integers P1,P2,,Pn,(1Pin), denoting the given permutation.

 n1n5×105,0kn.

For all test cases 6n5×106

输出格式

For each test case:

Print one integer in a line, denoting the answer number modulo 998 244 353.

输入样例 复制

3
5 1
5 3 2 1 4
5 2
2 5 1 3 4
10 3
10 9 3 8 6 4 5 7 2 1

输出样例 复制

5
5
40