Universal Cup Judging System

Universal Cup

Time Limit: 2.0 s Memory Limit: 1024 MB Total points: 100
Statistics

输入文件:标准输入
输出文件:标准输出
时间限制:2 秒
内存限制:1024 兆字节

著名的游戏节目又带着新一季回归了——这次是异或版!节目规则如下:参赛者有一个袋子,最初是空的。接下来依次进行 (n) 轮。每轮都会向参赛者提供一个整数,该整数从 ([0; 2^k - 1]) 中均匀随机选出。参赛者可以选择将它放入袋子,也可以最终跳过它。经过全部 (n) 轮后,参赛者将获得与袋中所有数字的异或值相等的奖品。注意,空袋中所有数字的异或值视为零。

参赛者知道 (n) 和 (k),也知道数字是从 ([0; 2^k - 1]) 中均匀随机生成的,但不知道这些数字的具体取值。基于这些信息,参赛者会优化策略,以最大化奖品的期望值。此外,为了让节目更精彩,如果在最优策略下,拿取或不拿取下一个数字所得到的期望值相同,参赛者总会选择拿取该数字。

你是节目的制作人。你拿到了一份明天节目将使用的整数列表,这些整数确实是均匀随机生成的。你想尽可能降低参赛者的奖品,以减少节目成本。但更改数字本身可能会引起过多怀疑;因此,你只想改变这些数字呈现给参赛者的顺序。当然,你会秘密进行此事,没人知道这种操作,包括参赛者;因此,参赛者的策略不会改变。请找出一种可能的数字排列,使参赛者尽可能少赢钱!

输入格式

输入的第一行包含两个整数 (k, n)((4 \le k \le 18, 10^k \le n \le 2 \cdot 10^5))。

下一行包含 (n) 个整数 (a_1, a_2, \ldots, a_n)((0 \le a_i < 2^k))。保证这些整数是均匀随机生成的。

本题共有 90 个测试点,对于每个满足 (4 \le k \le 18) 的 (k),有 6 个测试点;(n) 的取值在 (10^k) 和 (2 \cdot 10^5) 之间按等差数列分布,包含两端。

输出格式

输出 (n) 个整数:重新排列后的数组 (a_1, a_2, \ldots, a_n),使得结果值最小。如果有多个答案,输出任意一个。

样例

输入格式 1

4 40
4 12 3 5 9 7 0 6 13 10
12 14 14 7 2 8 3 4 2 3
4 9 13 4 13 6 10 2 0 10
4 9 15 13 10 8 6 7 14 3

输出格式 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.