QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 110

#13439. 啜泣

Statistiques

在一个阴暗沉闷的圣诞前夜,我们的主人公正虚弱疲惫地思考着一道奇特而有趣的 COCI 题目。当他点头打盹,几乎快要睡着时,突然听到一阵敲击声,接着是一声巨响。一只巨大的驯鹿破门而入,仅此而已,别无他物。主人公的心微微颤动,而那头巨兽只是简单地吐出一句话:“你不解决这个问题,我是不会离开的。”

在本题中,给定两个整数 $N$ 和 $M$。你需要将集合 $A = \{0, 1, 2, \dots, N - 1\}$ 和 $B = \{M, \dots, M + N - 1\}$ 中的数完美匹配成 $N$ 个数对,使得对于每对匹配的数 $x \in A$ 和 $y \in B$,均满足 $x \ \& \ y = x$,其中 $\&$ 表示按位与(bitwise AND)运算。

输入格式

第一行包含两个整数 $N$ 和 $M$ ($1 \le N \le M, N + M \le 10^6$),含义如题面所述。

输出格式

输出 $N$ 行,每行输出两个整数 $x$ 和 $y$,其中 $x$ 属于集合 $A$,$y$ 属于集合 $B$。每行中的数字应对应题面中所述的匹配对之一。

可以证明,解总是存在的。

子任务

子任务 得分 数据范围
1 10 $N$ 是 $2$ 的幂
2 29 $N + M$ 是 $2$ 的幂
3 39 $N + M \le 1000$
4 32 无附加限制

样例

输入样例 1

1 3

输出样例 1

0 3

输入样例 2

3 5

输出样例 2

0 5
1 7
2 6

输入样例 3

5 10

输出样例 3

0 12
1 13
2 10
3 11
4 14

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.