luogu#P10707. 永恒(Eternity)

永恒(Eternity)

Background

Walkingamongtheworld,Walking among the world, maynotbeangels.may not be angels. Thosewhobringdisaster,Those who bring disaster, maynotbedemons.may not be demons. Ademonstearsaretreasuredbyangels,A demon's tears are treasured by angels, andanangelspurityisguardedbydemons.and an angel's purity is guarded by demons. Perhaps,Perhaps, thisisthebestending.this is the best ending.

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 xx, let its elements be a1,a2axa_1,a_2\dots a_x. Then the value of this multiset is a1a2axa_1\oplus a_2\oplus \dots \oplus a_x, that is, the xor sum of all elements in the multiset.

Now given n,mn,m.

How many different multisets SS of size nn satisfy:

$$\max\limits_{T \subseteq S,T\ne \emptyset}{Q_T}=m$$

where QTQ_T is the value of multiset TT.

Note: Due to the nature of multisets, multisets with the same numbers but different orders are considered the same multiset. For example, {1,2,3}\left \{ 1,2,3 \right \} and {3,2,1}\left \{ 3,2,1 \right \} are the same multiset.

Output the number of different multisets modulo 998244353998244353.

It can be proven that the number of such multisets is finite.

Input Format

The first line contains two integers, representing nn and mm.

Output Format

One line with one integer, the answer modulo 998244353998244353.

3 5
13
12 7
48643

Hint

Sample Explanation

In sample 1, the 1313 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$$