結果

問題 No.2071 Shift and OR
ユーザー ああいいああいい
提出日時 2022-09-17 21:14:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 105,864 KB
最終ジャッジ日時 2023-08-23 17:54:29
合計ジャッジ時間 5,751 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
77,140 KB
testcase_01 AC 81 ms
78,544 KB
testcase_02 AC 83 ms
79,156 KB
testcase_03 AC 88 ms
80,376 KB
testcase_04 AC 84 ms
79,584 KB
testcase_05 AC 99 ms
82,164 KB
testcase_06 AC 86 ms
80,088 KB
testcase_07 AC 83 ms
79,152 KB
testcase_08 AC 82 ms
80,104 KB
testcase_09 AC 83 ms
79,980 KB
testcase_10 AC 84 ms
79,676 KB
testcase_11 AC 100 ms
82,252 KB
testcase_12 AC 103 ms
82,700 KB
testcase_13 AC 98 ms
82,136 KB
testcase_14 AC 74 ms
76,648 KB
testcase_15 AC 91 ms
81,108 KB
testcase_16 AC 94 ms
80,704 KB
testcase_17 AC 105 ms
82,224 KB
testcase_18 AC 81 ms
78,236 KB
testcase_19 AC 110 ms
82,764 KB
testcase_20 AC 106 ms
83,112 KB
testcase_21 AC 70 ms
71,156 KB
testcase_22 AC 112 ms
82,560 KB
testcase_23 AC 106 ms
102,252 KB
testcase_24 AC 77 ms
76,332 KB
testcase_25 AC 87 ms
87,168 KB
testcase_26 AC 90 ms
89,176 KB
testcase_27 AC 74 ms
75,648 KB
testcase_28 AC 111 ms
105,864 KB
testcase_29 AC 111 ms
105,652 KB
testcase_30 AC 91 ms
80,392 KB
testcase_31 AC 86 ms
80,260 KB
testcase_32 AC 86 ms
80,244 KB
testcase_33 AC 87 ms
80,184 KB
testcase_34 AC 86 ms
80,252 KB
testcase_35 AC 86 ms
80,160 KB
testcase_36 AC 91 ms
80,188 KB
testcase_37 AC 90 ms
80,184 KB
testcase_38 AC 87 ms
80,396 KB
testcase_39 AC 89 ms
80,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

import sys
if N >= 15:
    print((1 << 16) - 1)
    exit()

C = 1 << 16
def shift(x):
    return (x >> 1) + (x & 1) * (1 << 15)
dp = [0] * C
dp[0] = 1
for a in A:
    nx = [0] * C
    for i in range(C):
        if dp[i]:
            for _ in range(16):
                nx[i | a] = 1
                a = shift(a)
    dp = nx
for i in range(C - 1,-1,-1):
    if dp[i]:
        print(i)
        exit()
0