結果

問題 No.2071 Shift and OR
ユーザー SidewaysOwl
提出日時 2022-09-17 10:43:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 82,664 KB
実行使用メモリ 111,608 KB
最終ジャッジ日時 2025-03-21 01:02:25
合計ジャッジ時間 5,806 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

def shift(x):
    return x//2 + (1 << 15) * (x % 2)
n = int(input())
a =list(map(int,input().split()))
dp = [0] * (1<<16)
dp[0] = 1
for i in range(min(15,n)):
    aa = a[i]
    n_dp = [0] * (1<<16)
    for j in range(14):
        for k in range(1<<16):
            if dp[k]:
                n_dp[k|aa] = 1
        aa = shift(aa)
    dp = n_dp
import sys
for i in range((1<<16)-1,-1,-1):
#     print(i)
    if dp[i]:sys.exit(print(i))
0