結果

問題 No.2730 Two Types Luggage
ユーザー ShirotsumeShirotsume
提出日時 2024-04-19 22:37:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 847 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 613 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 272,300 KB
最終ジャッジ日時 2024-04-19 22:37:50
合計ジャッジ時間 14,914 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
54,784 KB
testcase_01 AC 45 ms
55,168 KB
testcase_02 AC 54 ms
63,872 KB
testcase_03 AC 45 ms
55,424 KB
testcase_04 AC 67 ms
66,176 KB
testcase_05 AC 51 ms
63,488 KB
testcase_06 AC 50 ms
62,464 KB
testcase_07 AC 43 ms
55,040 KB
testcase_08 AC 44 ms
55,296 KB
testcase_09 AC 53 ms
63,488 KB
testcase_10 AC 69 ms
69,888 KB
testcase_11 AC 361 ms
206,432 KB
testcase_12 AC 814 ms
264,644 KB
testcase_13 AC 323 ms
176,372 KB
testcase_14 AC 389 ms
225,644 KB
testcase_15 AC 471 ms
103,024 KB
testcase_16 AC 172 ms
120,416 KB
testcase_17 AC 462 ms
235,144 KB
testcase_18 AC 449 ms
229,544 KB
testcase_19 AC 76 ms
82,048 KB
testcase_20 AC 216 ms
135,300 KB
testcase_21 AC 362 ms
205,140 KB
testcase_22 AC 472 ms
253,848 KB
testcase_23 AC 113 ms
93,184 KB
testcase_24 AC 217 ms
145,328 KB
testcase_25 AC 412 ms
210,444 KB
testcase_26 AC 136 ms
105,668 KB
testcase_27 AC 358 ms
204,116 KB
testcase_28 AC 207 ms
143,032 KB
testcase_29 AC 421 ms
231,412 KB
testcase_30 AC 420 ms
93,312 KB
testcase_31 AC 321 ms
175,280 KB
testcase_32 AC 285 ms
157,232 KB
testcase_33 AC 847 ms
272,300 KB
testcase_34 AC 806 ms
265,280 KB
testcase_35 AC 827 ms
269,872 KB
testcase_36 AC 812 ms
270,272 KB
testcase_37 AC 802 ms
269,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 61 - 1
mod = 998244353

n, m, w = mi()

a = li()
b = li()
c = li()

a.sort(reverse=True)

maxi = [0] * (n + 1)

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