luogu#P5387. [Cnoi2019] 人形演舞
[Cnoi2019] 人形演舞
Background
Since the problem setters have all retired, the background has been put off indefinitely.
Problem Description
There is a game between Cirno and Marisa:
First, a sequence is given, and all numbers are in .
On each turn, a player may choose , , and require that , then change into .
denotes bitwise XOR.
If a player cannot make a move, then that player is considered to lose.
Assume that both Cirno and Marisa use optimal strategies.
Now Cirno wants to know, when she moves first, what is the number of winning initial sequences modulo .
Input Format
One line with two integers and .
Output Format
One line, the answer.
4 5
312
Hint
For of the testdata, and .
This problem uses bundled tests.
Translated by ChatGPT 5