結果

問題 No.2730 Two Types Luggage
ユーザー playerplayer
提出日時 2024-04-22 18:20:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 987 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 268,508 KB
最終ジャッジ日時 2024-04-22 18:20:52
合計ジャッジ時間 19,145 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,096 KB
testcase_01 AC 40 ms
51,840 KB
testcase_02 AC 51 ms
60,928 KB
testcase_03 AC 41 ms
52,224 KB
testcase_04 AC 72 ms
62,848 KB
testcase_05 AC 62 ms
60,288 KB
testcase_06 AC 48 ms
59,776 KB
testcase_07 AC 41 ms
51,968 KB
testcase_08 AC 41 ms
52,224 KB
testcase_09 AC 53 ms
60,928 KB
testcase_10 AC 59 ms
68,608 KB
testcase_11 AC 438 ms
232,072 KB
testcase_12 AC 925 ms
267,064 KB
testcase_13 AC 453 ms
215,340 KB
testcase_14 AC 484 ms
232,968 KB
testcase_15 AC 490 ms
107,392 KB
testcase_16 AC 247 ms
138,164 KB
testcase_17 AC 574 ms
263,252 KB
testcase_18 AC 481 ms
256,948 KB
testcase_19 AC 84 ms
85,376 KB
testcase_20 AC 254 ms
157,056 KB
testcase_21 AC 416 ms
241,196 KB
testcase_22 AC 605 ms
266,244 KB
testcase_23 AC 137 ms
97,736 KB
testcase_24 AC 297 ms
177,484 KB
testcase_25 AC 426 ms
230,372 KB
testcase_26 AC 163 ms
115,608 KB
testcase_27 AC 443 ms
240,344 KB
testcase_28 AC 240 ms
168,648 KB
testcase_29 AC 480 ms
258,796 KB
testcase_30 AC 478 ms
97,408 KB
testcase_31 AC 356 ms
210,508 KB
testcase_32 AC 302 ms
174,704 KB
testcase_33 AC 987 ms
267,608 KB
testcase_34 AC 957 ms
268,504 KB
testcase_35 AC 904 ms
268,256 KB
testcase_36 AC 908 ms
268,508 KB
testcase_37 AC 904 ms
268,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

n, m, w = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
acc = [0] + list(accumulate(a))
ans = -1

for i in range(1 << m):
    weight = 0
    value = 0
    for j in range(m):
        if i >> j & 1:
            weight += b[j]
            value += c[j]
    if weight > w:
        continue
    ans = max(ans, value + acc[min(n, w - weight)])

print(ans)
0