Divide by Zero 2018 and Codeforces Round 474 (Div. 1 + Div. 2, combined)
G
Bandit Blues
Codeforces
2900
原题
← FH →
翻译中…

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$.

翻译中…

Input

翻译中…

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

翻译中…

Output

翻译中…

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

翻译中…

Note

翻译中…

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*$.

翻译中…

样例

Input #1
1 1 1
Output #1
1
InputCopy OutputCopy
Input #2
2 1 1
Output #2
0
InputCopy OutputCopy
Input #3
2 2 1
Output #3
1
InputCopy OutputCopy
Input #4
5 2 2
Output #4
22
InputCopy OutputCopy
题目信息
题号
960G
时间限制
3.5 s
内存限制
256 MB
标签
组合数学
动态规划
FFT
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。