結果

問題 No.2071 Shift and OR
ユーザー titia
提出日時 2022-09-16 22:17:03
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 605 bytes
コンパイル時間 1,085 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 889,924 KB
最終ジャッジ日時 2024-12-21 21:28:02
合計ジャッジ時間 32,951 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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=0

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

    X="".join(map(str,DP))
    ANS=max(ANS,int(X,2))

print(ANS)
0