CF960G Bandit Blues

• 158通过
• 290提交
• 题目来源
• 评测方式 RemoteJudge
• 标签
• 难度 NOI/NOI+/CTSC
• 时空限制 3500ms / 256MB
• 提示：收藏到任务计划后，可在首页查看。

题意翻译

给你三个正整数 $n$，$a$，$b$，定义 $A$ 为一个排列中是前缀最大值的数的个数，定义 $B$ 为一个排列中是后缀最大值的数的个数，求长度为 $n$ 的排列中满足 $A = a$ 且 $B = b$ 的排列个数。$n \le 10^5$，答案对 $998244353$ 取模。

感谢@OrangeLee 提供翻译

题目描述

Japate, while traveling through the forest of Mala, saw $N$ bags of gold lying in a row. Each bag has some distinct weight of gold between $1$ to $N$ . Japate can carry only one bag of gold with him, so he uses the following strategy to choose a bag.

Initially, he starts with an empty bag (zero weight). He considers the bags in some order. If the current bag has a higher weight than the bag in his hand, he picks the current bag.

Japate put the bags in some order. Japate realizes that he will pick $A$ bags, if he starts picking bags from the front, and will pick $B$ bags, if he starts picking bags from the back. By picking we mean replacing the bag in his hand with the current one.

Now he wonders how many permutations of bags are possible, in which he picks $A$ bags from the front and $B$ bags from back using the above strategy.

Since the answer can be very large, output it modulo $998244353$ .

输入输出格式

输入格式：

The only line of input contains three space separated integers $N$ ( $1<=N<=10^{5}$ ), $A$ and $B$ ( $0<=A,B<=N$ ).

输出格式：

Output a single integer — the number of valid permutations modulo $998244353$ .

输入输出样例

输入样例#1： 复制
1 1 1

输出样例#1： 复制
1
输入样例#2： 复制
2 1 1

输出样例#2： 复制
0
输入样例#3： 复制
2 2 1

输出样例#3： 复制
1
输入样例#4： 复制
5 2 2

输出样例#4： 复制
22

说明

In sample case $1$ , the only possible permutation is $[1]$

In sample cases $2$ and $3$ , only two permutations of size $2$ are possible: ${[1,2],[2,1]}$ . The values of $a$ and $b$ for first permutation is $2$ and $1$ , and for the second permutation these values are $1$ and $2$ .

In sample case $4$ , out of 120 permutations of $[1,2,3,4,5]$ possible, only 22 satisfy the given constraints of $a$ and $b$ .

提示
标程仅供做题后或实在无思路时参考。
请自觉、自律地使用该功能并请对自己的学习负责。
如果发现恶意抄袭标程，将按照I类违反进行处理。