結果

問題 No.2071 Shift and OR
ユーザー dn6049949dn6049949
提出日時 2022-09-16 21:45:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 201 ms / 2,000 ms
コード長 953 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 94,172 KB
最終ジャッジ日時 2023-08-23 14:46:50
合計ジャッジ時間 8,191 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
78,116 KB
testcase_01 AC 116 ms
78,872 KB
testcase_02 AC 120 ms
79,908 KB
testcase_03 AC 138 ms
80,832 KB
testcase_04 AC 126 ms
80,256 KB
testcase_05 AC 162 ms
82,388 KB
testcase_06 AC 129 ms
80,072 KB
testcase_07 AC 123 ms
79,964 KB
testcase_08 AC 126 ms
80,256 KB
testcase_09 AC 129 ms
80,212 KB
testcase_10 AC 129 ms
80,336 KB
testcase_11 AC 162 ms
82,832 KB
testcase_12 AC 162 ms
82,992 KB
testcase_13 AC 156 ms
82,224 KB
testcase_14 AC 106 ms
77,732 KB
testcase_15 AC 148 ms
81,228 KB
testcase_16 AC 145 ms
81,368 KB
testcase_17 AC 165 ms
82,856 KB
testcase_18 AC 109 ms
78,824 KB
testcase_19 AC 179 ms
83,436 KB
testcase_20 AC 175 ms
83,436 KB
testcase_21 AC 201 ms
85,664 KB
testcase_22 AC 185 ms
84,420 KB
testcase_23 AC 127 ms
92,124 KB
testcase_24 AC 102 ms
77,424 KB
testcase_25 AC 115 ms
83,788 KB
testcase_26 AC 119 ms
84,824 KB
testcase_27 AC 103 ms
76,932 KB
testcase_28 AC 127 ms
93,896 KB
testcase_29 AC 127 ms
94,172 KB
testcase_30 AC 137 ms
80,564 KB
testcase_31 AC 129 ms
80,936 KB
testcase_32 AC 126 ms
80,584 KB
testcase_33 AC 129 ms
80,800 KB
testcase_34 AC 130 ms
80,872 KB
testcase_35 AC 133 ms
80,748 KB
testcase_36 AC 135 ms
80,912 KB
testcase_37 AC 128 ms
80,692 KB
testcase_38 AC 129 ms
80,856 KB
testcase_39 AC 129 ms
80,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def main():
    def shift(x):
        return (x>>1)+((x&1)<<15)
    n = I()
    a = LI()
    m = 2**16
    if n > 15:
        print(m-1)
        return
    f = [0]*m
    f[0] = 1
    for i in a:
        nf = [0]*m
        for _ in range(16):
            for x in range(m):
                if not f[x]:
                    continue
                nf[x|i] = 1
            i = shift(i)
        f = nf
    for i in reversed(range(m)):
        if f[i]:
            print(i)
            return
    return


if __name__ == "__main__":
    main()
0