CF1743G.Antifibonacci Cut
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Note that the memory limit is unusual.
Let's define the sequence of Fibonacci strings as follows: f0 is 0, f1 is 1, fi is fi−1+fi−2 for i>1 ( + denotes the concatenation of two strings). So, for example, f2 is 10, f3 is 101, f4 is 10110.
For a given string s , let's define g(s) as the number of ways to cut it into several (any number, possibly even just one) strings such that none of these strings are Fibonacci strings. For example, if s is 10110101, g(s)=3 since there are three ways to cut it:
- 101101 + 01;
- 1011 + 0101;
- 1011 + 01 + 01.
You are given a sequence of strings s1,s2,…,sn . Calculate g(s1),g(s1+s2),…,g(s1+s2+…+sn) . Since these values can be huge, print them modulo 998244353 .
输入格式
The first line of the input contains one integer n ( 1≤n≤3⋅103 ).
Then, n lines follow. The i -th line contains the string si ( 1≤∣si∣≤103 ), consisting of characters 0 and/or 1.
输出格式
Print n integers, where the i -th integer is g(s1+s2+…+si)mod998244353 .
输入输出样例
输入#1
1 10110101
输出#1
3
输入#2
3 1111 1 0
输出#2
2 3 3
输入#3
6 10110101 100100001110 0000001100010001 1111 1001010100101010101001 000100000010101111
输出#3
3 561 1466229 9887505 972227653 52128355