結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,800 KB
testcase_01 AC 78 ms
75,964 KB
testcase_02 AC 78 ms
75,848 KB
testcase_03 AC 81 ms
76,048 KB
testcase_04 AC 81 ms
76,104 KB
testcase_05 AC 81 ms
76,176 KB
testcase_06 AC 80 ms
76,152 KB
testcase_07 WA -
testcase_08 AC 79 ms
76,028 KB
testcase_09 AC 80 ms
75,992 KB
testcase_10 WA -
testcase_11 AC 81 ms
75,980 KB
testcase_12 WA -
testcase_13 AC 80 ms
75,976 KB
testcase_14 AC 74 ms
75,588 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 82 ms
75,860 KB
testcase_18 AC 78 ms
75,968 KB
testcase_19 AC 84 ms
75,972 KB
testcase_20 AC 83 ms
75,976 KB
testcase_21 AC 81 ms
76,584 KB
testcase_22 AC 81 ms
75,940 KB
testcase_23 AC 103 ms
102,452 KB
testcase_24 AC 73 ms
76,044 KB
testcase_25 AC 84 ms
87,668 KB
testcase_26 AC 88 ms
89,388 KB
testcase_27 AC 71 ms
75,588 KB
testcase_28 AC 108 ms
106,008 KB
testcase_29 AC 108 ms
105,880 KB
testcase_30 AC 78 ms
75,968 KB
testcase_31 AC 79 ms
75,956 KB
testcase_32 WA -
testcase_33 AC 77 ms
76,044 KB
testcase_34 AC 80 ms
76,000 KB
testcase_35 AC 80 ms
76,020 KB
testcase_36 AC 80 ms
76,196 KB
testcase_37 WA -
testcase_38 AC 78 ms
75,912 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] | a
            xx = x
            z=15
            while z:
                z-=1
                x = shift(x)
                if xx<x:
                    xx = x
            dp[i+1][j] = max(dp[i+1][j], xx)
        a = shift(a)



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