結果

問題 No.2071 Shift and OR
ユーザー 👑 rin204rin204
提出日時 2022-09-16 21:24:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 124,672 KB
最終ジャッジ日時 2024-12-21 18:20:36
合計ジャッジ時間 5,689 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
if n >= 16:
    print((1 << 16) - 1)
    exit()

se = {0}
for a in A:
    nex = set()
    cand = set()
    for _ in range(16):
        cand.add(a)
        t = a & 1
        a >>= 1
        if t:
            a |= 1 << 15
    
    for a in cand:
        for b in se:
            nex.add(a | b)
    se = nex
print(max(se))
        
0