結果

問題 No.2071 Shift and OR
ユーザー rlangevinrlangevin
提出日時 2023-01-28 11:15:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,208 KB
実行使用メモリ 106,060 KB
最終ジャッジ日時 2023-09-11 01:32:17
合計ジャッジ時間 8,497 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
78,024 KB
testcase_01 AC 114 ms
78,204 KB
testcase_02 AC 129 ms
79,516 KB
testcase_03 AC 136 ms
80,452 KB
testcase_04 AC 129 ms
79,996 KB
testcase_05 AC 155 ms
81,980 KB
testcase_06 AC 133 ms
79,964 KB
testcase_07 AC 125 ms
79,448 KB
testcase_08 AC 130 ms
80,004 KB
testcase_09 AC 129 ms
79,920 KB
testcase_10 AC 130 ms
79,820 KB
testcase_11 AC 161 ms
82,376 KB
testcase_12 AC 160 ms
82,524 KB
testcase_13 AC 154 ms
82,080 KB
testcase_14 AC 95 ms
77,396 KB
testcase_15 AC 140 ms
81,028 KB
testcase_16 AC 141 ms
81,164 KB
testcase_17 AC 162 ms
82,580 KB
testcase_18 AC 112 ms
78,552 KB
testcase_19 AC 166 ms
83,104 KB
testcase_20 AC 166 ms
83,244 KB
testcase_21 AC 185 ms
83,044 KB
testcase_22 AC 172 ms
83,080 KB
testcase_23 AC 109 ms
102,604 KB
testcase_24 AC 77 ms
76,388 KB
testcase_25 AC 89 ms
87,444 KB
testcase_26 AC 93 ms
89,384 KB
testcase_27 AC 74 ms
75,568 KB
testcase_28 AC 111 ms
106,040 KB
testcase_29 AC 109 ms
106,060 KB
testcase_30 AC 137 ms
80,424 KB
testcase_31 AC 135 ms
80,556 KB
testcase_32 AC 134 ms
80,540 KB
testcase_33 AC 137 ms
80,588 KB
testcase_34 AC 135 ms
80,476 KB
testcase_35 AC 137 ms
80,468 KB
testcase_36 AC 135 ms
80,364 KB
testcase_37 AC 138 ms
80,452 KB
testcase_38 AC 138 ms
80,520 KB
testcase_39 AC 137 ms
80,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def shift(x):
    return ((x % 2) << 15) + x//2

N =int(input())
A = list(map(int, input().split()))
if N >= 16:
    print(2 ** 16 - 1)
    exit()
            
pre = [0] * (1 << 16)
pre[0] = 1 
for i in range(N):
    dp = [0] * (1 << 16)
    v = A[i]
    for s in range(1 << 16):
        for j in range(16):
            dp[s|v] |= pre[s]
            v = shift(v)
    pre, dp = dp, pre

for i in range(2 ** 16 - 1, -1, -1):
    if pre[i]:
        print(i)
        break
0