QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#12026. 火山哥的集合

統計

火山哥有 $n$ 个集合,第 $i$ 个集合一开始只有一个数 $a_i$,每次火山哥执行以下过程:等概率随机选择两个集合,将它们合并成一个集合。火山哥会重复以上操作直到剩下恰好 $k$ 个集合为止

设最后剩下的集合是 $S_{1...k}$,设一个集合 $T$ 的最大值为 $max(T)$,最小值为 $min(T)$,那么火山哥会得到 $\sum_{i=1}^{k}(max(S_i)-min(S_i))^2$ 的收益

设做到恰好剩下 $k$ 个集合的话,火山哥的期望收益为 $f(k)$,为了减小输出量,你只需要输出 $\sum_{k=l}^{r}f(k)^{97376}$ 对 $998244353$ 取模后的值

我们定义对于分数 $a/b$,它对 $998244353$ 取模的值为 $c$,当且仅当 $(b\times c)~mod~998244353=a$,且 $0\leq c < 998244353$

输入格式

第一行三个正整数 $n,l,r$

第二行 $n$ 个整数表示 $a_i$

输出格式

输出一个数,表示所需要求的答案

样例数据

样例 1 输入

3 1 3
1 2 3

样例 1 输出

686489728

样例 2 输入

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

样例 2 输出

430310636

子任务

Task1 (1pts):$l=r=1$

Task2 (9pts):$1\leq n\leq 7$

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

Task4 (11pts):$1\leq n\leq 100$

Task5 (21pts):$1\leq n\leq 2000$

Task6 (13pts):$l=r$

Task7 (37pts):无特殊限制

对于所有数据,满足 $1\leq n\leq 2\times 10^5$,$0\leq a_i < 998244353$,$1\leq l\leq r\leq n$

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.