結果

問題 No.2071 Shift and OR
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-09-17 10:43:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 86,636 KB
実行使用メモリ 114,472 KB
最終ジャッジ日時 2023-08-23 17:33:49
合計ジャッジ時間 6,972 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
76,904 KB
testcase_01 AC 92 ms
77,804 KB
testcase_02 AC 90 ms
78,804 KB
testcase_03 AC 111 ms
79,876 KB
testcase_04 AC 100 ms
79,404 KB
testcase_05 AC 136 ms
81,408 KB
testcase_06 AC 100 ms
79,292 KB
testcase_07 AC 92 ms
78,736 KB
testcase_08 AC 98 ms
79,432 KB
testcase_09 AC 101 ms
79,436 KB
testcase_10 AC 100 ms
79,236 KB
testcase_11 AC 134 ms
82,008 KB
testcase_12 AC 139 ms
82,004 KB
testcase_13 AC 131 ms
81,468 KB
testcase_14 AC 76 ms
76,448 KB
testcase_15 AC 118 ms
80,504 KB
testcase_16 AC 117 ms
80,284 KB
testcase_17 AC 141 ms
81,940 KB
testcase_18 AC 84 ms
77,728 KB
testcase_19 AC 157 ms
82,572 KB
testcase_20 AC 150 ms
82,288 KB
testcase_21 AC 171 ms
84,080 KB
testcase_22 AC 168 ms
82,992 KB
testcase_23 AC 151 ms
111,336 KB
testcase_24 AC 118 ms
84,920 KB
testcase_25 AC 134 ms
96,392 KB
testcase_26 AC 133 ms
98,424 KB
testcase_27 AC 116 ms
84,508 KB
testcase_28 AC 152 ms
114,344 KB
testcase_29 AC 154 ms
114,472 KB
testcase_30 AC 113 ms
79,704 KB
testcase_31 AC 102 ms
79,912 KB
testcase_32 AC 100 ms
79,768 KB
testcase_33 AC 105 ms
79,860 KB
testcase_34 AC 106 ms
80,068 KB
testcase_35 AC 106 ms
79,872 KB
testcase_36 AC 111 ms
79,704 KB
testcase_37 AC 111 ms
79,976 KB
testcase_38 AC 100 ms
79,948 KB
testcase_39 AC 102 ms
80,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def shift(x):
    return x//2 + (1 << 15) * (x % 2)
n = int(input())
a =list(map(int,input().split()))
dp = [0] * (1<<16)
dp[0] = 1
for i in range(min(15,n)):
    aa = a[i]
    n_dp = [0] * (1<<16)
    for j in range(14):
        for k in range(1<<16):
            if dp[k]:
                n_dp[k|aa] = 1
        aa = shift(aa)
    dp = n_dp
import sys
for i in range((1<<16)-1,-1,-1):
#     print(i)
    if dp[i]:sys.exit(print(i))
0