結果

問題 No.2071 Shift and OR
ユーザー mkawa2mkawa2
提出日時 2022-09-16 21:33:38
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 1,025 bytes
コンパイル時間 240 ms
使用メモリ 130,960 KB
最終ジャッジ日時 2023-01-11 06:03:53
合計ジャッジ時間 6,977 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 71 ms
75,708 KB
testcase_01 AC 76 ms
80,708 KB
testcase_02 AC 79 ms
83,172 KB
testcase_03 AC 119 ms
97,772 KB
testcase_04 AC 95 ms
89,876 KB
testcase_05 AC 162 ms
112,988 KB
testcase_06 AC 117 ms
93,588 KB
testcase_07 AC 83 ms
85,172 KB
testcase_08 AC 89 ms
86,496 KB
testcase_09 AC 101 ms
91,100 KB
testcase_10 AC 104 ms
93,716 KB
testcase_11 AC 178 ms
120,492 KB
testcase_12 AC 240 ms
122,556 KB
testcase_13 AC 156 ms
110,516 KB
testcase_14 AC 71 ms
75,892 KB
testcase_15 AC 136 ms
103,596 KB
testcase_16 AC 133 ms
104,216 KB
testcase_17 AC 231 ms
115,284 KB
testcase_18 AC 75 ms
80,760 KB
testcase_19 AC 281 ms
130,960 KB
testcase_20 AC 177 ms
117,784 KB
testcase_21 AC 219 ms
123,220 KB
testcase_22 AC 203 ms
128,516 KB
testcase_23 AC 106 ms
106,052 KB
testcase_24 AC 75 ms
80,696 KB
testcase_25 AC 88 ms
91,676 KB
testcase_26 AC 94 ms
93,508 KB
testcase_27 AC 72 ms
80,340 KB
testcase_28 AC 109 ms
109,280 KB
testcase_29 AC 108 ms
109,276 KB
testcase_30 AC 159 ms
105,572 KB
testcase_31 AC 93 ms
88,508 KB
testcase_32 AC 97 ms
90,980 KB
testcase_33 AC 101 ms
92,540 KB
testcase_34 AC 125 ms
94,764 KB
testcase_35 AC 114 ms
98,220 KB
testcase_36 AC 126 ms
104,592 KB
testcase_37 AC 106 ms
94,624 KB
testcase_38 AC 101 ms
92,616 KB
testcase_39 AC 95 ms
89,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

def sft(a):
    d = a & 1
    return a >> 1 | d << 15

n = II()
aa = LI()

if n > 15:
    ans = (1 << 16)-1
else:
    dp = [0]
    for a in aa:
        ndp = set()
        for _ in range(16):
            for v in dp: ndp.add(v | a)
            a = sft(a)
        dp = ndp
    ans = max(dp)

print(ans)
0