結果

問題 No.2071 Shift and OR
ユーザー lloyzlloyz
提出日時 2022-09-16 22:41:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 401 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 10,740 KB
実行使用メモリ 8,240 KB
最終ジャッジ日時 2023-08-23 16:16:26
合計ジャッジ時間 2,314 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,800 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 16 ms
7,864 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 17 ms
7,956 KB
testcase_12 AC 18 ms
8,004 KB
testcase_13 AC 17 ms
7,864 KB
testcase_14 AC 15 ms
7,856 KB
testcase_15 AC 17 ms
7,804 KB
testcase_16 WA -
testcase_17 AC 17 ms
7,956 KB
testcase_18 WA -
testcase_19 AC 18 ms
7,876 KB
testcase_20 AC 18 ms
7,908 KB
testcase_21 AC 18 ms
7,848 KB
testcase_22 AC 18 ms
7,952 KB
testcase_23 AC 15 ms
8,240 KB
testcase_24 AC 15 ms
8,100 KB
testcase_25 AC 14 ms
8,160 KB
testcase_26 AC 14 ms
8,164 KB
testcase_27 AC 15 ms
8,160 KB
testcase_28 AC 16 ms
8,164 KB
testcase_29 AC 15 ms
8,216 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 16 ms
7,796 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 16 ms
7,860 KB
testcase_39 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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