309387: CF1671F. Permutation Counting

Memory Limit:512 MB Time Limit:4 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Permutation Counting

题意翻译

我们称一个 $1\sim n$ 的排列是合法的,当且仅当其逆序数为 $k$,下降数为 $x$。 先给你 $n,k,x$,请输出合法排列的数量,对 $998244353$ 取模。 请注意**本题多测**,共有 $t(t\le30000)$ 组询问,均满足 $1\le n<998244353,1\le k,x\le11$。 注:一个 $1\sim n$ 的排列的**逆序数**定义为 $\sum\limits_{1\le i<j\le n}[a_i>a_j]$,**下降数**定义为 $\sum\limits_{1\le i<n}[a_i>a_{i+1}]$。

题目描述

Calculate the number of permutations $ p $ of size $ n $ with exactly $ k $ inversions (pairs of indices $ (i, j) $ such that $ i < j $ and $ p_i > p_j $ ) and exactly $ x $ indices $ i $ such that $ p_i > p_{i+1} $ . Yep, that's the whole problem. Good luck!

输入输出格式

输入格式


The first line contains one integer $ t $ ( $ 1 \le t \le 3 \cdot 10^4 $ ) — the number of test cases. Each test case consists of one line which contains three integers $ n $ , $ k $ and $ x $ ( $ 1 \le n \le 998244352 $ ; $ 1 \le k \le 11 $ ; $ 1 \le x \le 11 $ ).

输出格式


For each test case, print one integer — the answer to the problem, taken modulo $ 998244353 $ .

输入输出样例

输入样例 #1

5
10 6 4
7 3 1
163316 11 7
136373 11 1
325902 11 11

输出样例 #1

465
12
986128624
7636394
57118194

Input

题意翻译

我们称一个 $1\sim n$ 的排列是合法的,当且仅当其逆序数为 $k$,下降数为 $x$。 先给你 $n,k,x$,请输出合法排列的数量,对 $998244353$ 取模。 请注意**本题多测**,共有 $t(t\le30000)$ 组询问,均满足 $1\le n<998244353,1\le k,x\le11$。 注:一个 $1\sim n$ 的排列的**逆序数**定义为 $\sum\limits_{1\le i<j\le n}[a_i>a_j]$,**下降数**定义为 $\sum\limits_{1\le i<n}[a_i>a_{i+1}]$。

加入题单

算法标签: