結果

問題 No.3249 AND
ユーザー かみのさちほ
提出日時 2025-08-29 21:52:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 30,000 KB
最終ジャッジ日時 2025-08-29 23:59:13
合計ジャッジ時間 3,875 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19 WA * 1 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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

max_b = max(b_list)

max_bit = 1
while max_b > 1:
    # print(max_b)
    max_bit += 1
    max_b >>= 1

# print(max_bit)

r = 0
for n in range(max_bit):
    k = 2**n
    if b_list[k - 1] == 2**n:
        r += 2**n
    else:
        continue
is_true = True
for n in range(N):
    if (n + 1) & r == b_list[n]:
        continue
    else:
        is_true = False

if is_true:
    print(r)
else:
    print(-1)
0