結果

問題 No.2730 Two Types Luggage
ユーザー SPD_9X2
提出日時 2024-04-19 21:41:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 885 ms / 2,000 ms
コード長 509 bytes
コンパイル時間 2,836 ms
コンパイル使用メモリ 82,060 KB
実行使用メモリ 259,116 KB
最終ジャッジ日時 2024-10-11 14:29:17
合計ジャッジ時間 16,301 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
A.append(0)
A.reverse()

for i in range(len(A)-1):
    A[i+1] += A[i]

ans = 0
for bit in range(2**M):

    nw = 0
    nc = 0
    for i in range(M):
        if (1<<i) & bit:
            nw += B[i]
            nc += C[i]

    #print (nw,nc,A)
    remw = W - nw
    if remw >= 0:
        nc += A[min(remw , len(A)-1)]

        ans = max(ans , nc)

print (ans)
0