結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
76,580 KB
testcase_01 AC 81 ms
76,596 KB
testcase_02 AC 81 ms
76,556 KB
testcase_03 AC 84 ms
76,676 KB
testcase_04 AC 82 ms
76,660 KB
testcase_05 AC 83 ms
76,660 KB
testcase_06 AC 84 ms
76,652 KB
testcase_07 WA -
testcase_08 AC 82 ms
76,316 KB
testcase_09 AC 82 ms
76,784 KB
testcase_10 WA -
testcase_11 AC 83 ms
76,604 KB
testcase_12 WA -
testcase_13 AC 83 ms
76,508 KB
testcase_14 AC 74 ms
76,608 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 82 ms
76,680 KB
testcase_18 AC 84 ms
77,164 KB
testcase_19 AC 83 ms
76,600 KB
testcase_20 AC 81 ms
76,372 KB
testcase_21 AC 86 ms
76,728 KB
testcase_22 AC 83 ms
76,500 KB
testcase_23 AC 104 ms
102,592 KB
testcase_24 AC 73 ms
76,288 KB
testcase_25 AC 85 ms
87,588 KB
testcase_26 AC 87 ms
89,516 KB
testcase_27 AC 71 ms
75,916 KB
testcase_28 AC 107 ms
106,100 KB
testcase_29 AC 107 ms
106,128 KB
testcase_30 AC 81 ms
76,676 KB
testcase_31 AC 80 ms
76,496 KB
testcase_32 WA -
testcase_33 AC 81 ms
76,504 KB
testcase_34 AC 83 ms
76,424 KB
testcase_35 AC 81 ms
76,708 KB
testcase_36 AC 80 ms
76,556 KB
testcase_37 WA -
testcase_38 AC 80 ms
76,748 KB
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0

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

ans = 0
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