結果

問題 No.2071 Shift and OR
ユーザー ikomaikoma
提出日時 2022-09-16 22:24:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 471 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 121,628 KB
最終ジャッジ日時 2023-08-23 16:02:50
合計ジャッジ時間 6,432 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
76,372 KB
testcase_01 AC 82 ms
76,712 KB
testcase_02 AC 84 ms
76,592 KB
testcase_03 AC 85 ms
76,604 KB
testcase_04 AC 83 ms
76,208 KB
testcase_05 AC 85 ms
76,356 KB
testcase_06 AC 82 ms
76,612 KB
testcase_07 WA -
testcase_08 AC 82 ms
76,668 KB
testcase_09 AC 83 ms
76,604 KB
testcase_10 WA -
testcase_11 AC 84 ms
76,420 KB
testcase_12 WA -
testcase_13 AC 84 ms
76,336 KB
testcase_14 AC 74 ms
76,268 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 82 ms
76,512 KB
testcase_18 AC 83 ms
76,764 KB
testcase_19 AC 83 ms
76,524 KB
testcase_20 AC 85 ms
76,740 KB
testcase_21 AC 86 ms
76,748 KB
testcase_22 AC 85 ms
76,536 KB
testcase_23 TLE -
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 #

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



def shift(x):
    return (x>>1) + (1<<15) * (x&1)

dp = [[0]*16 for _ in range(N+1)]

for i in range(N):
    a = A[i]
    for j in range(16):
        for k in range(16):
            x = dp[i][k]
            xx = x | a
            for _ in range(16):
                x = shift(x)
                if xx<x|a:
                    xx = x|a
            dp[i+1][j] = max(dp[i+1][j], xx)
        a = shift(a)

print(max(dp[-1]))
0