結果

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

ソースコード

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