結果

問題 No.3249 AND
ユーザー Kude
提出日時 2025-08-29 23:37:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 189 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 82,656 KB
実行使用メモリ 106,508 KB
最終ジャッジ日時 2025-09-05 11:40:14
合計ジャッジ時間 3,798 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
b = list(map(int, input().split()))
x = 0
for bi in b:
    x |= bi
if x == 0: x = 1 << n.bit_length()
ok = all(b[i] == (i + 1) & x for i in range(n))
print(x if ok else -1)
0