結果
問題 | No.2730 Two Types Luggage |
ユーザー |
|
提出日時 | 2024-04-19 21:54:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 941 ms / 2,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 268,736 KB |
最終ジャッジ日時 | 2024-10-11 14:55:08 |
合計ジャッジ時間 | 15,499 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
from itertools import accumulate, productN, 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()))BC = [[b, c] for b, c in zip(B, C)]acc = [0] + list(accumulate(A))ans = 0for bit in product([0, 1], repeat=M):w = 0; p = 0for i in range(M):if bit[i]:w += BC[i][0]p += BC[i][1]if w > W:continueans = max(ans, p + acc[min(N, W-w)])print(ans)