結果

問題 No.3249 AND
ユーザー akebono03
提出日時 2025-09-03 16:53:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 30,252 KB
最終ジャッジ日時 2025-09-03 16:53:09
合計ジャッジ時間 4,943 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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()
x = 0
for b in B:
  x |= b
if x == 0:
  for k in range(100):
    if 2 ** k > N:
      print(2 ** k)
      exit()
for i, b in enumerate(B, 1):
  if b != i & x:
    print(-1)
    exit()
print(x)
0