AtCoder Beginner Contest 456(Promotion of AtCoder Career Design DAY)
G
统计假日
Count Holidays
AtCoder
⌀ 2488
原题
← F→

统计假日AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

Takahashi is creating a work schedule for $N$ days by designating each day as a workday or a holiday.

Takahashi 正在安排 $N$ 天的工作日程,将每天指定为工作日或休息日。AI (CI翻译)

You are given a string $S$ of length $N$ representing the constraints on work days. If the $i$-th character of $S$ is x, day $i$ must be a workday. If it is ., day $i$ can be either a workday or a holiday.

给定一个长度为 $N$ 的字符串 $S$,表示对工作日的限制。如果 $S$ 的第 $i$ 个字符是 x,则第 $i$ 天必须是工作日;如果是 .,则第 $i$ 天可以是工作日,也可以是休息日。AI (CI翻译)

There are $2^q$ valid work schedules satisfying the constraints, where $q$ is the number of . characters in $S$. For each $k=1,2,\dots,N$, solve the following problem:

满足这些限制的工作日程共有 $2^q$ 种,其中 $q$ 是 $S$ 中 . 字符的数量。对于每个 $k=1,2,\dots,N$,请解决以下问题:AI (CI翻译)

Among the $2^q$ valid work schedules satisfying the constraints, find the number, modulo $998244353$, of schedules in which the longest consecutive block of holidays is exactly $k$ days.

在满足这些限制的 $2^q$ 种工作日程中,求最长连续休息日区块恰好为 $k$ 天的日程数量,结果对 $998244353$ 取模。

AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $N$ is an integer between $1$ and $2 \times 10^5$, inclusive.
  • $S$ is a string of length $N$ consisting of ., x.
  • $N$ 是一个介于 $1$ 和 $2 \times 10^5$ 之间的整数(含端点)。
  • $S$ 是一个长度为 $N$、仅由 . 和 x 组成的字符串。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format:

输入从标准输入按以下格式给出:AI (CI翻译)

N
S

N
S
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output $N$ lines. The $i$-th line should contain the answer for $k=i$.

输出 $N$ 行。第 $i$ 行应包含 $k=i$ 时的答案。AI (CI翻译)

样例

Input #1
5
.x...
Output #1
9
4
2
0
0
Denoting holidays as `o`, the valid work schedules are as follows: - $k=1$: `oxxxx`, `oxoxx`, `oxoxo`, `oxxox`, `oxxxo`, `xxoxx`, `xxoxo`, `xxxox`, `xxxxo` - $k=2$: `oxoox`, `oxxoo`, `xxoox`, `xxxoo` - $k=3$: `oxooo`, `xxooo`
Input #2
7
.......
Output #2
33
47
27
12
5
2
1
Input #3
20
.....x...x..........
Output #3
9359
75312
94664
46840
23680
7168
3072
1280
512
256
0
0
0
0
0
0
0
0
0
0
题目信息
题号
abc456_g
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。