2026牛客国庆集训派对day6
I
Removing Elements
牛客竞赛
未评级
原题
← HJ →

Removing Elements官方中文

题目描述

官方中文

Let $T \subseteq \{1,2,\ldots,n\}$ be a set of integers. Suppose you have a set $S = \{1,2,\ldots,n\}$. You may perform the following operations an arbitrary number of times (including zero times): Choose $k \in T$ such that $k \le |S|$; Remove the $k$-th largest element in $S$. Find the total number of sets $S$ that can be generated through the process. The answer might be enormous, and you should output the desired value modulo $998\,244\,353$.官方中文

输入格式

官方中文

The first line of input contains an integer $n$ ($1 \le n \le 200\,000$).官方中文

The second line of input contains a binary string $s=s_1 s_2\ldots s_n$ of length $n$, denoting the set $T=\{1 \le i \le n \mid s_i = 1\}$.官方中文

输出格式

官方中文

Output an integer in a line, denoting the answer.
官方中文

样例

Input #1
3
101
Output #1
6
Input #2
5
00001
Output #2
2
Input #3
10
1011011000
Output #3
695
题目信息
题号
nc140734pi
时间限制
10 s
内存限制
1024 MB

题面与样例版权归 牛客竞赛 及出题人所有;中文翻译由 AI 生成(官方原文),如有出入请以原文为准。