結果

問題 No.2071 Shift and OR
ユーザー lloyzlloyz
提出日時 2022-09-16 23:30:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 82,268 KB
実行使用メモリ 69,736 KB
最終ジャッジ日時 2024-06-01 14:12:32
合計ジャッジ時間 6,089 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
61,820 KB
testcase_01 AC 64 ms
62,544 KB
testcase_02 AC 79 ms
64,608 KB
testcase_03 AC 123 ms
64,348 KB
testcase_04 AC 97 ms
64,584 KB
testcase_05 AC 181 ms
66,524 KB
testcase_06 AC 107 ms
65,168 KB
testcase_07 AC 84 ms
63,292 KB
testcase_08 AC 92 ms
64,048 KB
testcase_09 AC 96 ms
64,828 KB
testcase_10 AC 101 ms
64,660 KB
testcase_11 AC 186 ms
67,720 KB
testcase_12 AC 187 ms
67,552 KB
testcase_13 AC 167 ms
65,980 KB
testcase_14 AC 53 ms
60,556 KB
testcase_15 AC 144 ms
64,956 KB
testcase_16 AC 142 ms
65,208 KB
testcase_17 AC 196 ms
66,812 KB
testcase_18 AC 64 ms
61,756 KB
testcase_19 AC 226 ms
68,204 KB
testcase_20 AC 218 ms
67,656 KB
testcase_21 AC 271 ms
69,736 KB
testcase_22 AC 241 ms
68,844 KB
testcase_23 AC 39 ms
52,700 KB
testcase_24 AC 39 ms
52,488 KB
testcase_25 AC 38 ms
52,444 KB
testcase_26 AC 39 ms
52,776 KB
testcase_27 AC 38 ms
52,696 KB
testcase_28 AC 39 ms
52,240 KB
testcase_29 AC 38 ms
52,880 KB
testcase_30 AC 122 ms
64,600 KB
testcase_31 AC 100 ms
66,248 KB
testcase_32 AC 100 ms
64,764 KB
testcase_33 AC 103 ms
65,188 KB
testcase_34 AC 110 ms
65,100 KB
testcase_35 AC 110 ms
64,188 KB
testcase_36 AC 118 ms
64,808 KB
testcase_37 AC 106 ms
65,104 KB
testcase_38 AC 105 ms
65,672 KB
testcase_39 AC 103 ms
65,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n >= 16:
    print((1 << 16) - 1)
    exit()

A = list(map(int, input().split()))
DP = [[False for _ in range(1 << 16)] for _ in range(n + 1)]
header = 1 << 15
for i in range(n + 1):
    DP[i][0] = True
for i in range(n):
    a = A[i]
    for j in range(16):
        for k in range(1 << 16):
            if DP[i][k]:
                DP[i + 1][k | a] |= DP[i][k]
        a, r = divmod(a, 2)
        a |= header * r
for i in range((1 << 16) - 1, 0, -1):
    if DP[n][i]:
        print(i)
        break
0