#arc173f. F - Select and Split
F - Select and Split
Score: points
问题陈述
黑板上写着一组正整数。最初,黑板上写着集合 ( S={1,2,\dots,A,A+1,A+2,\dots,A+B} )。
高桥想要执行以下操作 ( N-1 ) 次,以便在黑板上得到 ( N ) 个集合:
- 从黑板上写的整数集合中,选择一个集合 ( S_0 ),该集合至少包含一个不超过 ( A ) 的元素,并且至少包含一个不少于 ( A+1 ) 的元素。从选定的集合 ( S_0 ) 中,选择一个不超过 ( A ) 的元素 ( a ) 和一个不少于 ( A+1 ) 的元素 ( b )。从黑板上擦掉集合 ( S_0 ) 并写下两个集合 ( S_1 ) 和 ( S_2 ),这两个集合由他选择,并且满足以下所有条件:
- ( S_1 ) 和 ( S_2 ) 的并集是 ( S_0 ),并且它们没有共同元素。
- ( a \in S_1, b \in S_2 )
找出执行一系列操作的可能方式的数量,对 ( 998244353 ) 取模。
在这里,当存在 ( i\ (1 \leq i \leq N-1) ) 使得一个系列中 ( i ) 次操作选择的 ( S_0 ),( a ),( b ),( S_1 ) 或 ( S_2 ) 与另一个系列中的不同,则认为两个操作系列是不同的。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
There is a blackboard with a set of positive integers written on it. Initially, the set is written on the blackboard.
Takahashi wants to perform the following operation times to have sets on the blackboard:
- From the sets of integers written on the blackboard, choose a set that contains at least one element not greater than and at least one element not less than . From the chosen set , choose one element not greater than and one element not less than . Erase the set from the blackboard and write two sets and of his choice that satisfy all of the following conditions:
- The union of and is , and they have no common elements.
Find the number of possible ways to perform the series of operations, modulo .
Here, two series of operations are distinguished when there is an such that , , , , or chosen in the -th operation of one series is different from that of the other series.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 2 4
Sample Output 1
1728
One possible series of operations is as follows:
- Choose , let and , and let and . There are now two sets of integers written on the blackboard: and .
- Choose , let and , and let and . There are now three sets of integers written on the blackboard: , , and .
Sample Input 2
4 1 3
Sample Output 2
6
If we let and and let and in the first operation, we can no longer perform the second and subsequent operations.
Do not count these cases where we cannot complete operations.
Sample Input 3
5 6 6
Sample Output 3
84486693
Sample Input 4
173173 173173 173173
Sample Output 4
446948086