AT_abc456_g.Count Holidays
省选/NOI-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Takahashi is creating a work schedule for N days by designating each day as a workday or a holiday.
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.
There are 2q valid work schedules satisfying the constraints, where q is the number of . characters in S. For each k=1,2,…,N, solve the following problem:
Among the 2q 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.
高桥正在为 N 天制定工作计划,每天被指定为工作日或休息日。
给定一个长度为 N 的字符串 S,表示对工作日的约束。若 S 的第 i 个字符为 x,则第 i 天必须是工作日;若为 .,则第 i 天可以是工作日或休息日。
满足约束条件的有效工作计划共有 2q 种,其中 q 是 S 中字符 . 的个数。对每个 k=1,2,…,N,求解以下问题:
在满足约束条件的 2q 个有效工作计划中,最长连续休息日段恰好为 k 天的计划个数(对 998244353 取模)。
输入格式
The input is given from Standard Input in the following format:
N
S
输入从标准输入中按以下格式给出:
N
S
输出格式
Output N lines. The i-th line should contain the answer for k=i.
输出 N 行。第 i 行应包含 k=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=1:
oxxxx,oxoxx,oxoxo,oxxox,oxxxo,xxoxx,xxoxo,xxxox,xxxxo - k=2:
oxoox,oxxoo,xxoox,xxxoo - k=3:
oxooo,xxooo
Constraints
- N is an integer between 1 and 2×105, inclusive.
- S is a string of length N consisting of
.,x.
样例 1 解释:
用 o 表示假期,合法的工作安排如下:
- k=1:
oxxxx,oxoxx,oxoxo,oxxox,oxxxo,xxoxx,xxoxo,xxxox,xxxxo - k=2:
oxoox,oxxoo,xxoox,xxxoo - k=3:
oxooo,xxooo
限制条件
- N 是一个介于 1 到 2×105(含)之间的整数。
- S 是一个长度为 N 的字符串,仅由字符
.和x组成。
输入解题思路,AI测评打分。不知道怎么写?