AT_abc456_g.Count Holidays

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

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

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

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

高桥正在为 NN 天制定工作计划,每天被指定为工作日或休息日。

给定一个长度为 NN 的字符串 SS,表示对工作日的约束。若 SS 的第 ii 个字符为 x,则第 ii 天必须是工作日;若为 .,则第 ii 天可以是工作日或休息日。

满足约束条件的有效工作计划共有 2q2^q 种,其中 qq 是 SS 中字符 . 的个数。对每个 k=1,2,…,Nk=1,2,\dots,N,求解以下问题:

在满足约束条件的 2q2^q 个有效工作计划中,最长连续休息日段恰好为 kk 天的计划个数(对 998244353998244353 取模)。

输入格式

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

NN
SS

输入从标准输入中按以下格式给出:

NN
SS

输出格式

Output NN lines. The ii-th line should contain the answer for k=ik=i.

输出 NN 行。第 ii 行应包含 k=ik=i 时的答案。

输入输出样例

  • 输入#1

    5
    .x...

    输出#1

    9
    4
    2
    0
    0
  • 输入#2

    7
    .......

    输出#2

    33
    47
    27
    12
    5
    2
    1
  • 输入#3

    20
    .....x...x..........

    输出#3

    9359
    75312
    94664
    46840
    23680
    7168
    3072
    1280
    512
    256
    0
    0
    0
    0
    0
    0
    0
    0
    0
    0

说明/提示

Sample 1 Explanation:
Denoting holidays as o, the valid work schedules are as follows:

  • k=1k=1: oxxxx, oxoxx, oxoxo, oxxox, oxxxo, xxoxx, xxoxo, xxxox, xxxxo
  • k=2k=2: oxoox, oxxoo, xxoox, xxxoo
  • k=3k=3: oxooo, xxooo

Constraints

  • NN is an integer between 11 and 2×1052 \times 10^5, inclusive.
  • SS is a string of length NN consisting of ., x.

样例 1 解释:
用 o 表示假期,合法的工作安排如下:

  • k=1k=1: oxxxx, oxoxx, oxoxo, oxxox, oxxxo, xxoxx, xxoxo, xxxox, xxxxo
  • k=2k=2: oxoox, oxxoo, xxoox, xxxoo
  • k=3k=3: oxooo, xxooo

限制条件

  • NN 是一个介于 11 到 2×1052 \times 10^5(含)之间的整数。
  • SS 是一个长度为 NN 的字符串,仅由字符 . 和 x 组成。

输入解题思路,AI测评打分。不知道怎么写?

首页