#P10593. BZOJ2958 序列染色
BZOJ2958 序列染色
Background
This problem comes from the original BZOJ. We acknowledge that the copyright of the statement and the original testdata belongs to the original BZOJ or to the problem author(s) who authorized BZOJ to use it. If you are the copyright holder and believe that we have infringed your rights, please contact us.
Problem Description
You are given a string of length consisting of the three characters B, W, and X. You need to recolor each X into either B or W.
For the given , ask how many coloring methods make it possible that there exist integers satisfying:
- ;
- , ;
- ;
- .
Since the number of methods may be large, you only need to output the final answer modulo .
Input Format
The first line contains two positive integers .
The second line contains a string of length .
Output Format
Output one line containing one integer, representing the answer.
5 2
XXXXX
4
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5