結果

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

ソースコード

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