結果

問題 No.2071 Shift and OR
ユーザー titia
提出日時 2022-09-16 22:14:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 628 bytes
コンパイル時間 539 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 817,972 KB
最終ジャッジ日時 2024-12-21 21:17:41
合計ジャッジ時間 25,935 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 MLE * 1
other AC * 20 WA * 7 TLE * 2 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)

#print(ANS)

MAX=max(ANS)

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

print(int(X,2))
0