結果

問題 No.3249 AND
ユーザー detteiuu
提出日時 2025-08-29 21:28:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 106,964 KB
最終ジャッジ日時 2025-08-29 23:57:30
合計ジャッジ時間 4,203 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
B = list(map(int, input().split()))

ans = [-1]*20
for i in range(N):
    for j in range(20):
        if not 1<<j & (i+1):
            continue
        if ans[j] != -1 and ans[j] != (B[i]>>j & 1):
            exit(print(-1))
        ans[j] = B[i]>>j & 1

n = 0
for i in range(20):
    if ans[i] == 1:
        n |= 1<<i

print(n)
0