結果
問題 | No.2730 Two Types Luggage |
ユーザー | flygon |
提出日時 | 2024-04-19 21:29:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 981 ms / 2,000 ms |
コード長 | 685 bytes |
コンパイル時間 | 202 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 271,368 KB |
最終ジャッジ日時 | 2024-10-11 14:03:17 |
合計ジャッジ時間 | 17,277 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd 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 = a[::-1] cnt = [0] for i in range(n): cnt.append(cnt[-1] + a[i]) ans = 0 for bit in range(1<<m): ws = 0 vs = 0 for i in range(m): if (bit>>i) & 1: ws += b[i] vs += c[i] if ws <= w: ans = max(ans, vs+cnt[min(len(cnt)-1,w-ws)]) print(ans)