QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#839. 忽略子掩码

Statistics

给定一个包含 $n$ 个整数的数组 $a_1, a_2, \dots, a_n$。每个整数都在 $0$ 到 $2^k - 1$ 之间(含边界)。

定义 $f(x)$ 为满足 $(a_i \& x) \neq a_i$ 的最小下标 $i$(从 $1$ 开始计数);如果不存在这样的 $i$,则 $f(x) = 0$。其中 $(a \& b)$ 表示按位与运算。

求 $f(0) + f(1) + \dots + f(2^k - 1)$ 的值。由于该值可能非常大,请输出其对 $998\,244\,353$ 取模的结果。

输入格式

第一行包含两个整数:$n, k$ ($1 \le n \le 100, 1 \le k \le 60$)。

第二行包含 $n$ 个整数:$a_1, a_2, \dots, a_n$ ($0 \le a_i < 2^k$)。

输出格式

输出一个整数:$f(0) + f(1) + \dots + f(2^k - 1)$ 对 $998\,244\,353$ 取模的结果。

样例

输入格式 1

2 1
0 1

输出格式 1

2

说明

在第一个样例中,$f(0) = 2, f(1) = 0$。

输入格式 2

2 2
2 1

输出格式 2

4

说明

在第二个样例中,$f(0) = 1, f(1) = 1, f(2) = 2, f(3) = 0$。

输入格式 3

5 10
389 144 883 761 556

输出格式 3

1118

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.