結果

問題 No.3249 AND
ユーザー sasa8uyauya
提出日時 2025-08-30 01:29:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 262 bytes
コンパイル時間 453 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 107,984 KB
最終ジャッジ日時 2025-08-30 01:29:18
合計ジャッジ時間 4,468 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(range(1,n+1))
b=list(map(int,input().split()))
c=0
for j in range(20):
  if all((b[i]>>j)&1==0 for i in range(n)):
    continue
  if any((a[i]>>j)&1!=(b[i]>>j)&1 for i in range(n)):
    print(-1)
    exit()
  c+=1<<j
print(c if c>0 else -1)
0