QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100 Difficulty: [show]

#2072. Junk Problem

统计

浏览维基百科并阅读一些随机参考资料是编写题目的最佳方式。

寻找一个子集 $S \in \{1, 2, \dots, n\}$,使得:

  • 对于所有满足 $a, b \in S$ 且 $a < b$ 的数对 $(a, b)$,其按位异或(bitwise XOR)的结果必须互不相同。
  • $|S| \geq \sqrt{0.5n}$。

输入格式

第一行包含一个整数 $n$ ($1 \leq n \leq 10^7$)。

输出格式

第一行包含一个整数 $m$:集合 $S$ 的大小。 第二行包含 $m$ 个从 $1$ 到 $n$ 的不同整数:集合 $S$ 中的元素,顺序不限。

样例

输入 1

49

输出 1

4
1 2 3 4

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.