CF1671F.Permutation Counting

省选/NOI-

通过率:0%

时间限制:4.00s

内存限制:512MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Calculate the number of permutations pp of size nn with exactly kk inversions (pairs of indices (i,j)(i, j) such that i<ji \lt j and pi>pjp_i \gt p_j) and exactly xx indices ii such that pi>pi+1p_i \gt p_{i+1}.

Yep, that's the whole problem. Good luck!

计算长度为 nn 的排列 pp 的个数,使得该排列恰好有 kk 个逆序对(即满足 i<ji \lt j 且 pi>pjp_i \gt p_j 的下标对 (i,j)(i, j) 的个数),且恰好有 xx 个下标 ii 满足 pi>pi+1p_i \gt p_{i+1}。

没错,这就是整个题目。祝你好运!

输入格式

The first line contains one integer tt (1≤t≤3⋅1041 \le t \le 3 \cdot 10^4) — the number of test cases.

Each test case consists of one line which contains three integers nn, kk and xx (1≤n≤9982443521 \le n \le 998244352; 1≤k≤111 \le k \le 11; 1≤x≤111 \le x \le 11).

第一行包含一个整数 tt(1≤t≤3⋅1041 \le t \le 3 \cdot 10^4)—— 测试用例的数量。

每个测试用例由一行组成,该行包含三个整数 nn、kk 和 xx(1≤n≤9982443521 \le n \le 998244352;1≤k≤111 \le k \le 11;1≤x≤111 \le x \le 11)。

输出格式

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

对于每个测试用例,输出一个整数——该问题的答案对 998244353998244353 取模的结果。

输入输出样例

  • 输入#1

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

    输出#1

    465
    12
    986128624
    7636394
    57118194

输入解题思路,AI测评打分。不知道怎么写?

首页