QOJ.ac

QOJ

Limite de temps : 3 s Limite de mémoire : 1024 MB Points totaux : 100

#2554. AND PLUS OR

Statistiques

对于两个非负整数 $a, b$,令 $a \wedge b$ 为它们的按位与运算结果,$a \vee b$ 为它们的按位或运算结果。

给定一个长度为 $2^N$ 的非负整数数组 $A_0, A_1, \dots, A_{2^N-1}$。请找到一对下标 $0 \le i, j \le 2^N - 1$,使得 $A_i + A_j < A_{i \wedge j} + A_{i \vee j}$,或者指出不存在这样的下标对。如果存在多组解,输出其中任意一组即可。

输入格式

第一行包含一个整数 $N$ ($0 \le N \le 20$)。

第二行包含 $2^N$ 个整数:$A_0, A_1, \dots, A_{2^N-1}$ ($0 \le A_i \le 10^7$)。

输出格式

如果存在满足条件的解,输出两个整数 $i$ 和 $j$ 表示答案。$i$ 和 $j$ 的取值范围应在 $[0, 2^N - 1]$ 内。否则,输出 -1。

样例

样例输入 1

2
0 1 1 2

样例输出 1

-1

样例输入 2

2
0 1 1 3

样例输出 2

2 1

样例输入 3

0
100

样例输出 3

-1

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#866EditorialOpen题解alpha10222026-01-28 02:33:38View
#584Editorial Open集训队作业 解题报告 by 曹轩鸣Qingyu2026-01-02 22:35:06 Download

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.