結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
75,920 KB
testcase_01 AC 83 ms
76,108 KB
testcase_02 AC 81 ms
76,008 KB
testcase_03 AC 83 ms
75,972 KB
testcase_04 AC 81 ms
76,196 KB
testcase_05 AC 81 ms
76,224 KB
testcase_06 AC 81 ms
76,084 KB
testcase_07 WA -
testcase_08 AC 80 ms
76,072 KB
testcase_09 AC 81 ms
76,072 KB
testcase_10 WA -
testcase_11 AC 84 ms
76,152 KB
testcase_12 WA -
testcase_13 AC 83 ms
76,072 KB
testcase_14 AC 75 ms
75,548 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 81 ms
75,940 KB
testcase_18 AC 79 ms
76,152 KB
testcase_19 AC 82 ms
76,224 KB
testcase_20 AC 82 ms
76,056 KB
testcase_21 AC 83 ms
76,524 KB
testcase_22 AC 81 ms
76,188 KB
testcase_23 AC 104 ms
102,464 KB
testcase_24 AC 75 ms
76,124 KB
testcase_25 AC 84 ms
87,380 KB
testcase_26 AC 90 ms
89,752 KB
testcase_27 AC 73 ms
75,688 KB
testcase_28 AC 108 ms
105,780 KB
testcase_29 AC 107 ms
105,784 KB
testcase_30 AC 79 ms
76,064 KB
testcase_31 AC 78 ms
76,084 KB
testcase_32 WA -
testcase_33 AC 80 ms
76,220 KB
testcase_34 AC 80 ms
76,012 KB
testcase_35 AC 80 ms
76,024 KB
testcase_36 AC 81 ms
76,020 KB
testcase_37 WA -
testcase_38 AC 80 ms
76,256 KB
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0

if N>15:
    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
            z=15
            while z:
                z-=1
                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