QOJ.ac

QOJ

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

#5569. 不同的子序列

统计

Ethan 拥有一个长度为 $n$ 的二进制字符串 $s$。他想送给 Justin 一个 $s$ 的子序列作为生日礼物。为了让这份礼物变得特别,他希望子序列的长度恰好为 Justin 最喜欢的数字 $k$。

请计算 Ethan 可以送给 Justin 的不同礼物的数量。由于该值可能很大,请输出其对 $998244353$ 取模的结果。

注意:在本题中,“不同”指的是子序列的值。如果一个潜在的礼物作为 $s$ 的子序列在多个位置出现,它只被计算一次。

输入格式

第一行包含两个整数 $n$ 和 $k$ ($1 \le k \le n \le 2 \cdot 10^5$),分别表示字符串 $s$ 的长度和所需子序列的长度。

第二行包含一个长度为 $n$ 的二进制字符串 $s$。

输出格式

输出 $s$ 中长度为 $k$ 的不同子序列的数量,对 $998244353$ 取模。

样例

输入 1

5 3
00110

输出 1

5

输入 2

12 8
000111000000

输出 2

12

输入 3

31 12
1110100111110110101111010100010

输出 3

3985

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.