#P3673. 小清新计数题
小清新计数题
Description
Xiao A is playing a game on the computer called Truth or Lie.
At the start of the game, the computer gives sentences. Each sentence is of the form “Statement is true” or “Statement is false,” where is an integer from to . You only need to choose either "Good" or "Bad." "Good" means that you can determine the truth value of each statement so that the content of every sentence holds. "Bad" means the opposite.
As a newbie, Xiao A keeps clicking "Good" and hopes to pass by luck.
After countless failures, Xiao A discovers that in each level, whether a sentence contains the word “true” or “false” is fixed, but the in each sentence is chosen uniformly at random from to .
Now Xiao A tells you, for a certain level, which word each sentence contains, represented by a sequence. The -th bit being means the -th sentence contains “false,” otherwise it contains “true.” He wants to know the number of assignments of the ’s that make clicking "Good" correct.
Since the number of valid assignments may be large, you need to output the result modulo .
(If you do not understand the problem, please refer to the sample explanation.)
Input Format
A single line containing a sequence, whose length is .
Output Format
Output the number of valid assignments modulo .
01
1
10101
1154
10101101010111110100110100101010110001010010101001
322173207
Hint
Sample Explanation
The first sentence says “Some statement is false,” and the second sentence says “Some statement is true.” All possible cases are as follows:
- The first sentence says “Statement 1 is false,” the second says “Statement 1 is true.” The result should be Bad.
- The first sentence says “Statement 1 is false,” the second says “Statement 2 is true.” The result should be Bad.
- The first sentence says “Statement 2 is false,” the second says “Statement 1 is true.” The result should be Bad.
- The first sentence says “Statement 2 is false,” the second says “Statement 2 is true.” The result should be Good, because setting the first statement to false and the second statement to true satisfies both sentences, so it is Good.
Therefore, there is exactly one valid assignment.
Constraints
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
- For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号