#P10877. 「KDOI-07」n1gr tS0i
「KDOI-07」n1gr tS0i
Background
As everyone knows, Little T does not like 01 string problems, so Little R made another problem about 01 strings.
Problem Description
There is a string of length . You need to perform exactly operations on . In each operation, choose , and then flip bit by bit. Here, “flip bit by bit” means that all in become at the same time, and all become at the same time.
After operations, find the number of all possible distinct strings . Since the answer may be very large, output it modulo .
Input Format
This problem has multiple test cases.
The first line contains an integer describing the number of test cases. For each test case:
- The first line contains an integer .
- The next line contains a string of length .
Output Format
For each test case, output one integer per line, the answer modulo .
2
2
01
30
101001001010100110101101011110
1
75497471
Hint
Sample Explanation
- For , , we will find that in each operation we can only choose , that is, flipping the whole string. Therefore, after operations we can only get , so the answer is .
- For the second test case, we cannot give you a clear answer for now.
Constraints
This problem uses bundled testdata.
| Score | ||
|---|---|---|
For all testdata, it is guaranteed that , , and .
Translated by ChatGPT 5