atcoder#ARC139F. [ARC139F] Many Xor Optimization Problems

[ARC139F] Many Xor Optimization Problems

Score : 10001000 points

Problem Statement

PCT made the following problem.

Xor Optimization ProblemYou are given a sequence of non-negative integers of length NN: A1,A2,...,ANA_1,A_2,...,A_N. When it is allowed to choose any number of elements in AA, what is the maximum possible XOR\mathrm{XOR} of the chosen values?

Nyaan thought it was too easy and revised it to the following.

Many Xor Optimization ProblemsThere are 2NM2^{NM} sequences of length NN consisting of integers between 00 and 2M12^M-1. Find the sum, modulo 998244353998244353, of the answers to Xor Optimization Problem for all those sequences.

Solve Many Xor Optimization Problems.

What is bitwise $\mathrm{XOR}$?

The bitwise XOR\mathrm{XOR} of non-negative integers AA and BB, ABA \oplus B, is defined as follows:

  • When ABA \oplus B is written in base two, the digit in the 2k2^k's place (k0k \geq 0) is 11 if exactly one of AA and BB is 11, and 00 otherwise.
$$3 \oplus 5 = 6$$$$011 \oplus 101 = 110$$$$\mathrm{XOR}$$$$k$$$$p_1, p_2, p_3, \dots, p_k$$$$(\dots ((p_1 \oplus p_2) \oplus p_3) \oplus \dots \oplus p_k)$$$$p_1, p_2, p_3, \dots, p_k $$

Constraints

  • 1N,M2500001 \le N,M \le 250000
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

Output

Print the answer.

2 1
3

We are to solve Xor Optimization Problem for all sequences of length 22 consisting of integers between 00 and 11.

  • The answer for A=(0,0)A=(0,0) is 00.
  • The answer for A=(0,1)A=(0,1) is 11.
  • The answer for A=(1,0)A=(1,0) is 11.
  • The answer for A=(1,1)A=(1,1) is 11.

Thus, the final answer is 0+1+1+1=30+1+1+1=3.

3 4
52290
1234 5678
495502261