結果

問題 No.2071 Shift and OR
ユーザー titia
提出日時 2022-09-16 22:15:03
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 615 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 896,852 KB
最終ジャッジ日時 2024-12-21 21:21:29
合計ジャッジ時間 31,467 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 MLE * 1
other AC * 18 WA * 5 TLE * 6 MLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from itertools import permutations

def shift(x):
    return x//2+(1<<15)*(x%2)

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

if N>=16:
    print(2**16-1)
    exit()

ANS=[]

L=list(permutations(range(N)))

for l in L:
    DP=[0]*16
    for i in l:
        k=A[i]

        while k%2==0:
            k//=2

        for j in range(16):
            if DP[j]==0:
                break

        for b in range(16):
            if (1<<b) & k != 0:
                if j+b<16:
                    DP[j+b]=1
    ANS.append(DP)

MAX=max(ANS)

X="".join(map(str,MAX))

print(int(X,2))
0