AtCoder Grand Contest 060
C
Large Heap
AtCoder
⌀ 2680
原题
← BD →
翻译中…

Problem Statement

翻译中…

Consider a permutation $P=(P_1,P_2,\cdots,P_{2^N-1})$ of $(1,2,\cdots,2^N-1)$. $P$ is said to be heaplike if and only if all of the following conditions are satisfied.

翻译中…
  • $P_i < P_{2i}$ ($1 \leq i \leq 2^{N-1}-1$)
  • $P_i < P_{2i+1}$ ($1 \leq i \leq 2^{N-1}-1$)
翻译中…

You are given integers $A$ and $B$. Let $U=2^A$ and $V=2^{B+1}-1$.

翻译中…

Find the probability, modulo $998244353$, that $P_U<P_V$ for a heaplike permutation chosen uniformly at random.

翻译中…

Definition of probability modulo $998244353$ It can be proved that the sought probability is always rational. Additionally, under the constraints of this problem, when the sought rational number is represented as an irreducible fraction $\frac{P}{Q}$, it can be proved that $Q \neq 0 \pmod{998244353}$. Therefore, there is a unique integer $R$ such that $R \times Q \equiv P \pmod{998244353}$ and $0 \leq R \lt 998244353$. Print this $R$.

翻译中…

Constraints

翻译中…
  • $2 \leq N \leq 5000$
  • $1 \leq A,B \leq N-1$
  • All numbers in the input are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N A B

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
2 1 1
Output #1
499122177
There are two heaplike permutations: $P=(1,2,3),(1,3,2)$. The probability that $P_2
Input #2
3 1 2
Output #2
124780545
Input #3
4 3 2
Output #3
260479386
Input #4
2022 12 25
Output #4
741532295
题目信息
题号
agc060_c
时间限制
10 s
内存限制
1024 MB

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