問題一覧 > 通常問題

No.3249 AND

レベル : / AI推定難易度 : 650 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 49
作問者 : trqs / テスター : yukicoder
お気に入りにしたユーザー ProblemId : 12575 / 自分の提出
問題文最終更新日: 2026-10-20 14:55:56
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 480 (Gemini Tester) (順位表) の他の問題:

Note

As a first-time experiment, Gemini 2.5 Pro was made the tester for this problem.

Problem Statement

[2025/8/30] The constraints have been changed.
You are given an array $b$ of length $n$. For every $1 \le i \le n$, $b_i = i \operatorname{AND} x$ holds. Find the smallest positive integer $x$ satisfying the condition. If no solution exists, print −1.

Input

$n$
$b_1\ b_2\ \cdots\ b_n$

  • $1 \le n \le 2 \times 10^5$
  • $0 \le b_i \le 2 \times 10^5$
  • All inputs are integers.

  • Output

    Print the smallest $x$ satisfying the condition. If no solution exists, print −1.

    Sample

    Sample 1
    Input
    4  
    0 2 2 0  
    Output
    2

    提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。