luogu#P10707. 永恒(Eternity)
永恒(Eternity)
Background
Problem Description
Some preliminary definitions:
-
Elements in a multiset must be non-negative integers.
-
The size of a multiset is the number of elements in the multiset.
-
For a multiset of size , let its elements be . Then the value of this multiset is , that is, the xor sum of all elements in the multiset.
Now given .
How many different multisets of size satisfy:
$$\max\limits_{T \subseteq S,T\ne \emptyset}{Q_T}=m$$where is the value of multiset .
Note: Due to the nature of multisets, multisets with the same numbers but different orders are considered the same multiset. For example, and are the same multiset.
Output the number of different multisets modulo .
It can be proven that the number of such multisets is finite.
Input Format
The first line contains two integers, representing and .
Output Format
One line with one integer, the answer modulo .
3 5
13
12 7
48643
Hint
Sample Explanation
In sample 1, the valid multisets are:
$$(0,0,5)$$, $$(0,1,4)$$, $$(0,1,5)$$, $$(0,4,5)$$, $$(0,5,5)$$, $$(1,1,4)$$, $$(1,1,5)$$, $$(1,4,4)$$, $$(1,4,5)$$, $$(1,5,5)$$, $$(4,4,5)$$, $$(4,5,5)$$, $$(5,5,5)$$. #### Constraints | subtask ID | $n$ | $m$ | Special Property | Score | | :----------: | :----------: | :----------: | :----------: | :-----: | | $0$ | $\le 10$ | $\le 10$ | $-$ | $10$ | | $1$ | $\le 10^5$ | $<2^{60}$ | $A$ | $20$ | | $2$ | $\le 2000$ | $\le 2000$ | $-$ | $10$ | | $3$ | $\le 10^5$ | $<2^{60}$ | $-$ | $60$ | Special property $A$: $\operatorname{popcount}(m)\le 5\ $, where $\operatorname{popcount}(m)$ is the number of $1$ bits in the binary representation of $m$. For all testdata, it is guaranteed that $1\le n\le 10^5$, $0\le m<2^{60}$. **Special reminder: This problem uses bundled subtask testing. You can get the score of a subtask only if you pass all test points in that subtask.** Translated by ChatGPT 5$$