Binary Strings
Time limit1sMemory limit512 MB
Count the antisymmetric binary strings of length 2L that contain each of n given binary strings (n up to 6, length up to 20) as a substring, modulo 998244353.
- Level
Hard8 of 10
- Topics
- Dynamic programming, String matching, Bit manipulation
- Solved
- No attempts yet
Problem
A binary string is antisymmetric if for all with . Yuta has binary strings . He wants to count the binary antisymmetric strings of length that contain every given string as a contiguous substring. Print the count modulo .
Input
The first line contains two integers and (, ). Each of the next lines contains a string () made of the characters 0 and 1.
Output
Print a single integer: the answer modulo .
Hint
In the second example, the strings that satisfy all the restrictions are 000111, 001011, 011001, and 100110.