結果

問題 No.2730 Two Types Luggage
ユーザー ThetaTheta
提出日時 2024-04-23 19:23:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 715 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 268,224 KB
最終ジャッジ日時 2024-04-23 19:23:48
合計ジャッジ時間 17,434 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,096 KB
testcase_01 AC 40 ms
52,096 KB
testcase_02 AC 48 ms
59,904 KB
testcase_03 AC 38 ms
52,096 KB
testcase_04 AC 58 ms
62,464 KB
testcase_05 AC 46 ms
59,904 KB
testcase_06 AC 51 ms
57,984 KB
testcase_07 AC 38 ms
51,712 KB
testcase_08 AC 39 ms
51,840 KB
testcase_09 AC 47 ms
59,904 KB
testcase_10 AC 56 ms
68,608 KB
testcase_11 AC 417 ms
231,900 KB
testcase_12 AC 715 ms
266,892 KB
testcase_13 AC 332 ms
210,704 KB
testcase_14 AC 425 ms
233,200 KB
testcase_15 AC 348 ms
107,264 KB
testcase_16 AC 179 ms
135,456 KB
testcase_17 AC 504 ms
263,088 KB
testcase_18 AC 439 ms
256,664 KB
testcase_19 AC 84 ms
84,992 KB
testcase_20 AC 210 ms
154,280 KB
testcase_21 AC 416 ms
241,280 KB
testcase_22 AC 530 ms
265,964 KB
testcase_23 AC 106 ms
94,592 KB
testcase_24 AC 243 ms
177,080 KB
testcase_25 AC 419 ms
230,204 KB
testcase_26 AC 149 ms
113,300 KB
testcase_27 AC 408 ms
240,392 KB
testcase_28 AC 213 ms
165,812 KB
testcase_29 AC 429 ms
258,884 KB
testcase_30 AC 272 ms
94,464 KB
testcase_31 AC 345 ms
205,372 KB
testcase_32 AC 285 ms
174,616 KB
testcase_33 AC 681 ms
267,456 KB
testcase_34 AC 695 ms
268,212 KB
testcase_35 AC 706 ms
268,096 KB
testcase_36 AC 678 ms
268,224 KB
testcase_37 AC 690 ms
267,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate


def main():
    N, M, W = map(int, input().split())
    A = sorted(map(int, input().split()), reverse=True)
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))
    A_accum = list(accumulate(A, initial=0))
    max_value = 0
    for bit in range(2**M):
        tmp_bit = bit
        idx = 0
        Y_weight_sum = 0
        Y_value_sum = 0
        while tmp_bit > 0:
            if tmp_bit & 1:
                Y_weight_sum += B[idx]
                Y_value_sum += C[idx]
            idx += 1
            tmp_bit >>= 1
        if Y_weight_sum > W:
            continue
        max_value = max(
            max_value,
            Y_value_sum + A_accum[min(W - Y_weight_sum, N)]
        )
    print(max_value)


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