結果

問題 No.2071 Shift and OR
ユーザー yosakayosaka
提出日時 2022-09-16 23:45:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 279 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 100,736 KB
最終ジャッジ日時 2024-06-01 14:26:58
合計ジャッジ時間 6,971 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
63,616 KB
testcase_01 AC 80 ms
64,384 KB
testcase_02 AC 105 ms
66,944 KB
testcase_03 AC 154 ms
68,480 KB
testcase_04 AC 123 ms
68,096 KB
testcase_05 AC 196 ms
72,320 KB
testcase_06 AC 132 ms
68,480 KB
testcase_07 AC 112 ms
66,688 KB
testcase_08 AC 121 ms
67,712 KB
testcase_09 AC 129 ms
67,844 KB
testcase_10 AC 130 ms
67,840 KB
testcase_11 AC 206 ms
73,088 KB
testcase_12 AC 209 ms
73,268 KB
testcase_13 AC 193 ms
71,936 KB
testcase_14 AC 61 ms
60,800 KB
testcase_15 AC 160 ms
69,760 KB
testcase_16 AC 163 ms
70,016 KB
testcase_17 AC 215 ms
73,088 KB
testcase_18 AC 82 ms
64,128 KB
testcase_19 AC 235 ms
73,984 KB
testcase_20 AC 223 ms
74,240 KB
testcase_21 AC 279 ms
78,464 KB
testcase_22 AC 242 ms
75,648 KB
testcase_23 AC 77 ms
96,512 KB
testcase_24 AC 44 ms
62,056 KB
testcase_25 AC 62 ms
76,596 KB
testcase_26 AC 62 ms
79,232 KB
testcase_27 AC 42 ms
57,856 KB
testcase_28 AC 80 ms
100,736 KB
testcase_29 AC 80 ms
100,444 KB
testcase_30 AC 146 ms
69,068 KB
testcase_31 AC 134 ms
68,992 KB
testcase_32 AC 140 ms
68,992 KB
testcase_33 AC 143 ms
69,120 KB
testcase_34 AC 163 ms
69,632 KB
testcase_35 AC 136 ms
69,504 KB
testcase_36 AC 140 ms
68,992 KB
testcase_37 AC 134 ms
68,992 KB
testcase_38 AC 138 ms
69,248 KB
testcase_39 AC 140 ms
70,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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


def shift(x):
    return x // 2 + pow(2, 15) * (x % 2)


M = 1 << 16
dp = [False] * M
dp[0] = True
for a in A:
    ndp = [False] * M
    now = a
    for _ in range(16):
        for s in range(M):
            ndp[s | now] |= dp[s]
        now = shift(now)
    dp = ndp[:]
ans = 0
for i in range(M):
    if dp[i]:
        ans = max(ans, i)
print(ans)
0