QOJ.ac

QOJ

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

#12013. Rating

الإحصائيات

在退役四年后,九条可怜想从零单排再上一次 LGM。然而,因为可怜已经不剩下多少算法竞赛能力了,所以她想要用一些手段来保证她能上 LGM。

可怜新建了两个 CF 账号,初始 rating 都是 0 分。每当有一次 CF 比赛的时候,可怜会用当前 rating 较低的那一个账号参加比赛。在比赛结束之后,这个账号的 rating 会以如下方式变动。

  • 对于每一个 $i \in [-m,m]$,可怜获得 $i$ 点 rating 的概率是 $w_i$。其中 $m$ 是一个已知的常数。
  • 可怜参赛账号的 rating 会加上 $i$。特殊地,当计算结果小于 $0$ 时,rating 会对 $0$ 取 max。

可怜的目标是让 rating 较高的那个账号不少于 $n$ 分。现在,她想要知道为了达到这个目标,她期望要参加多少场 CF 比赛。

输入格式

第一行输入两个整数 $n,m$,表示 rating 的目标以及每场比赛变化的最大幅度。

第二行输入 $2m+1$ 个整数,表示 $w_{-m},w_{-m+1},\dots, w_{m}$。其中 $w_i$ 表示 rating 变化 $i$ 的概率是 $w_i / 10^8$。

输入保证 $\sum_{i=-m}^{m} w_i = 10^8$,并且 $\max(w_1, \dots, w_m) > 0$。

输出格式

输出一行一个整数,表示可怜参加比赛的期望场数对 $998244353$ 取模后的结果。

样例数据

样例 1 输入

3 1
0 0 100000000

样例 1 输出

5

样例 2 输入

3 1
50000000 0 50000000

样例 2 输出

18

样例 3 输入

3 1
87654321 12345678 1

样例 3 输出

218770954

样例 4 输入

995 5
7596668 8305741 17378882 1042723 15454211 8130546 13423369 13541276 10497878 4211898 416808

样例 4 输出

447430831

子任务

子任务一($11$ 分),$1 \leq n,m \leq 25$。

子任务二($21$ 分),$1 \leq n \leq 10^3, m = 1$。

子任务三($37$ 分),$1 \leq n \leq 10^3, 1 \leq m \leq 15$。

子任务四($31$ 分),$1 \leq n \leq 10^3, 1 \leq m \leq 50$。

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.