結果

問題 No.2071 Shift and OR
ユーザー yosakayosaka
提出日時 2022-09-16 23:45:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 329 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 87,252 KB
実行使用メモリ 105,880 KB
最終ジャッジ日時 2023-08-23 17:00:43
合計ジャッジ時間 9,148 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
78,704 KB
testcase_01 AC 119 ms
79,872 KB
testcase_02 AC 144 ms
81,692 KB
testcase_03 AC 187 ms
83,652 KB
testcase_04 AC 158 ms
82,732 KB
testcase_05 AC 238 ms
87,240 KB
testcase_06 AC 170 ms
82,756 KB
testcase_07 AC 149 ms
81,752 KB
testcase_08 AC 157 ms
82,840 KB
testcase_09 AC 165 ms
82,768 KB
testcase_10 AC 167 ms
82,936 KB
testcase_11 AC 251 ms
87,952 KB
testcase_12 AC 248 ms
87,888 KB
testcase_13 AC 235 ms
86,804 KB
testcase_14 AC 94 ms
77,540 KB
testcase_15 AC 198 ms
84,972 KB
testcase_16 AC 202 ms
84,900 KB
testcase_17 AC 249 ms
87,884 KB
testcase_18 AC 121 ms
79,696 KB
testcase_19 AC 272 ms
89,056 KB
testcase_20 AC 263 ms
88,836 KB
testcase_21 AC 329 ms
92,600 KB
testcase_22 AC 286 ms
90,224 KB
testcase_23 AC 113 ms
102,368 KB
testcase_24 AC 81 ms
76,328 KB
testcase_25 AC 94 ms
87,408 KB
testcase_26 AC 95 ms
89,456 KB
testcase_27 AC 78 ms
75,420 KB
testcase_28 AC 115 ms
105,880 KB
testcase_29 AC 117 ms
105,868 KB
testcase_30 AC 184 ms
83,900 KB
testcase_31 AC 173 ms
83,764 KB
testcase_32 AC 175 ms
83,948 KB
testcase_33 AC 176 ms
83,760 KB
testcase_34 AC 200 ms
83,724 KB
testcase_35 AC 175 ms
83,576 KB
testcase_36 AC 178 ms
83,556 KB
testcase_37 AC 174 ms
83,848 KB
testcase_38 AC 179 ms
83,768 KB
testcase_39 AC 180 ms
83,800 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