QOJ.ac

QOJ

时间限制: 2 s 内存限制: 256 MB 总分: 100

#12026. Brother Volcano's Set

统计

Volcano has $n$ sets, where the $i$-th set initially contains only one number $a_i$. In each step, Volcano chooses two sets uniformly at random and merges them into one. Volcano repeats this process until exactly $k$ sets remain.

Let the final sets be $S_1, \dots, S_k$. Let $max(T)$ and $min(T)$ denote the maximum and minimum values in a set $T$, respectively. Volcano receives a reward of $\sum_{i=1}^{k}(max(S_i)-min(S_i))^2$.

Let $f(k)$ be the expected reward when exactly $k$ sets remain. To reduce the output size, you only need to output the value of $\sum_{k=l}^{r}f(k)^{97376}$ modulo $998244353$.

We define the value of a fraction $a/b$ modulo $998244353$ as $c$ if and only if $(b\times c) \pmod{998244353} = a$, where $0 \leq c < 998244353$.

Input

The first line contains three positive integers $n, l, r$.

The second line contains $n$ integers representing $a_i$.

Output

Output a single number representing the required answer.

Examples

Input 1

3 1 3
1 2 3

Output 1

686489728

Input 2

13 1 13
1 1 4 5 1 4 1 9 1 9 8 1 0

Output 2

430310636

Subtasks

Task 1 (1 pt): $l=r=1$

Task 2 (9 pts): $1\leq n\leq 7$

Task 3 (8 pts): $l=r=n-1$

Task 4 (11 pts): $1\leq n\leq 100$

Task 5 (21 pts): $1\leq n\leq 2000$

Task 6 (13 pts): $l=r$

Task 7 (37 pts): No special constraints

For all data, $1\leq n\leq 2\times 10^5$, $0\leq a_i < 998244353$, and $1\leq l\leq r\leq n$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.