QOJ.ac

QOJ

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

#10374. 小 H 爱染色

Statistics

有排成一列的 $n$ 个球,编号依次为 $0$ 到 $n-1$ ,初始都为白色。小 $H$ 会重复以下操作共 $2$ 次:随机选择其中的 $m$ 个球将它们染成黑色(可以重复染黑球)。小 $H$ 对编号最小的黑球情有独钟,她想知道,如果令 $A$ 为它的编号, $F(A)$ 的期望是多少。其中, $F(x)$ 为一个次数不超过 $m$ 的多项式, $F(A)$ 表示 $x=A$ 时多项式的值。

输入格式

第一行两个整数 $n,m$ 。

第二行 $m+1$ 个整数,第 $i$ 个整数为 $F(i-1)$ 。

输出格式

一行一个整数,如果令 $E$ 表示 $F(A)$ 的期望,输出 $E\times {\binom{n}{m}}^2$ 模 $998244353$ 的值。

样例数据

样例输入

8 5
45856608 386378255 106492167 28766400 272276589 93721672

样例输出

321347828

子任务

  • 对于 $10\%$ 的数据,$n \leq 10$,$m \leq 5$
  • 对于 $20\%$ 的数据,$n \leq 100$,$m \leq 100$
  • 对于 $30\%$ 的数据,$n \leq 1000$,$m \leq 1000$
  • 对于另外 $5\%$ 的数据,$m \leq 1000000$,且保证多项式 $F(x)=1$
  • 对于另外 $5\%$ 的数据,$m \leq 5000$,且保证多项式 $F(x)=x$
  • 对于另外 $10\%$ 的数据,$m \leq 5000$,且保证多项式 $F(x)=x^m$
  • 对于 $70\%$ 的数据,$m \leq 5000$
  • 对于 $80\%$ 的数据,$m \leq 20000$
  • 对于 $100\%$ 的数据,$n \leq 998244353$,$m \leq 1000000$
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.