結果

問題 No.3249 AND
ユーザー akebono03
提出日時 2025-09-03 16:47:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 30,260 KB
最終ジャッジ日時 2025-09-03 16:47:57
合計ジャッジ時間 5,358 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

def ip():return int(input())
def mp():return map(int, input().split())
def lmp():return list(map(int, input().split()))
# No.3249 AND
N = ip()
B = lmp()
if N == 1 and B[0] == 0:
  print(2)
  exit()
x = 0
for i, b in enumerate(B, 1):
  x |= i & b
for i, b in enumerate(B, 1):
  if b != i & x:
    print(-1)
    exit()
print(x)
0