結果

問題 No.2071 Shift and OR
ユーザー vwxyzvwxyz
提出日時 2023-02-24 07:23:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 460 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 13,744 KB
最終ジャッジ日時 2023-10-01 04:45:06
合計ジャッジ時間 14,699 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 753 ms
13,724 KB
testcase_01 AC 1,108 ms
9,268 KB
testcase_02 AC 1,833 ms
9,204 KB
testcase_03 TLE -
testcase_04 TLE -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
import heapq

N=int(readline())
A=list(map(int,readline().split()))
if N>=16:
    ans=(1<<16)-1
else:
    dp=[False]*(1<<16)
    dp[0]=True
    for a in A:
        prev=dp
        dp=[False]*(1<<16)
        for bit in range(1<<16):
            for i in range(16):
                dp[bit|a]|=prev[bit]
                a=a>>1|(a&1)<<15
    for ans in range((1<<16)-1,-1,-1):
        if dp[ans]:
            break
print(ans)
0