QOJ.ac

QOJ

时间限制: 1 s 内存限制: 256 MB 总分: 100

#3908. K-ones xor

统计

给定整数 $n, m$ 和一个长度为 $n$ 的数组 $a_1, a_2, \dots, a_n$,其中每个元素都是 $m$ 位整数。同时给定一个整数 $k$。你需要找到一个 $m$ 位整数 $x$,其二进制表示中包含的 $1$ 的个数不超过 $k$。在所有满足条件的数中,你需要找到使得对数组执行 $a_i = \max(a_i, a_i \oplus x)$ 操作后,数组元素之和最大的那个数。$\oplus$ 表示按位异或运算。如果存在多个这样的数,你需要找到其中最小的一个。

输入格式

输入的第一行包含三个整数 $n, m, k$。第二行包含数组 $a_1, a_2, \dots, a_n$。

$1 \le n \le 10^5$ $1 \le m \le 30$ $0 \le k \le m$ $0 \le a_i < 2^m$

输出格式

输出一个整数 $x$,即该问题的答案。

$0 \le x < 2^m$

样例

样例输入 1

3 2 2
3 2 2

样例输出 1

1

样例输入 2

2 1 1
0 0

样例输出 2

1

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.