201395: [AtCoder]ARC139 F - Many Xor Optimization Problems

Memory Limit:1024 MB Time Limit:8 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $1000$ points

Problem Statement

PCT made the following problem.

Xor Optimization Problem

You are given a sequence of non-negative integers of length $N$: $A_1,A_2,...,A_N$. When it is allowed to choose any number of elements in $A$, what is the maximum possible $\mathrm{XOR}$ of the chosen values?

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

Many Xor Optimization Problems

There are $2^{NM}$ sequences of length $N$ consisting of integers between $0$ and $2^M-1$. Find the sum, modulo $998244353$, of the answers to Xor Optimization Problem for all those sequences.

Solve Many Xor Optimization Problems.

What is bitwise $\mathrm{XOR}$?

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

  • When $A \oplus B$ is written in base two, the digit in the $2^k$'s place ($k \geq 0$) is $1$ if exactly one of $A$ and $B$ is $1$, and $0$ otherwise.
For example, we have $3 \oplus 5 = 6$ (in base two: $011 \oplus 101 = 110$).
Generally, the bitwise $\mathrm{XOR}$ of $k$ non-negative integers $p_1, p_2, p_3, \dots, p_k$ is defined as $(\dots ((p_1 \oplus p_2) \oplus p_3) \oplus \dots \oplus p_k)$. We can prove that this value does not depend on the order of $p_1, p_2, p_3, \dots, p_k$.

Constraints

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

Input

Input is given from Standard Input in the following format:

$N$ $M$

Output

Print the answer.


Sample Input 1

2 1

Sample Output 1

3

We are to solve Xor Optimization Problem for all sequences of length $2$ consisting of integers between $0$ and $1$.

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

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


Sample Input 2

3 4

Sample Output 2

52290

Sample Input 3

1234 5678

Sample Output 3

495502261

Input

题意翻译

给定 $n,m$,$A_i$ 从 $[0,2^m-1]$ 中随机生成。 令 $F(A)$ 为所有子集异或和的最大值,即对于一个下标集合 $S=\{i_1,i_2,\cdots,i_k\}$,$A_{i_1}\oplus A_{i_2}\oplus\cdots\oplus A_{i_k}$ 的最大值。 对于 $2^{nm}$ 种生成方式,求 $F(A)$ 的和模 $998244353$。

加入题单

上一题 下一题 算法标签: