시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
3 초 (추가 시간 없음) 1024 MB 146 32 27 45.000%

문제

For two nonnegative integers $a, b$, let $a \wedge b$ be their bitwise AND, and $a \vee b$ be their bitwise OR.

You are given an array $A_0, A_1, \ldots, A_{2^N - 1}$ of length $2^N$ consisting of nonnegative integers. Please find a pair of indices $0 \le i, j \le 2^N - 1$ such that $A_{i} + A_{j} < A_{i \wedge j} + A_{i \vee j}$, or state that no such pair exists. If there is more than one such pair, print any.

입력

The first line contains an integer $N$.

The second line contains $2^N$ integers, the array $A$ given in order.

출력

If there is an answer, output two integers $i, j$ denoting the answer, separated by spaces. $i, j$ should be in the range $[0, 2^N - 1]$. Otherwise, output -1.

제한

  • $0 \leq N \leq 20$
  • $0 \leq A_i \leq 10^7$

서브태스크 1 (14점)

This subtask has an additional constraint.

  • $N \le 14$

서브태스크 2 (17점)

This subtask has an additional constraint.

  • $N \le 17$

서브태스크 3 (69점)

This subtask has no additional constraints.

예제 입력 1

2
0 1 1 2

예제 출력 1

-1

예제 입력 2

2
0 1 1 3

예제 출력 2

1 2

출처

University > KAIST > 2021 KAIST RUN Spring Contest F번

채점 및 기타 정보

  • 예제는 채점하지 않는다.