結果
問題 |
No.2730 Two Types Luggage
|
ユーザー |
|
提出日時 | 2024-04-20 15:41:51 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 870 ms / 2,000 ms |
コード長 | 474 bytes |
コンパイル時間 | 184 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 267,120 KB |
最終ジャッジ日時 | 2024-10-12 11:23:34 |
合計ジャッジ時間 | 16,674 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
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) cum_sum = [0] * (N + 1) for i in range(N): cum_sum[i + 1] = cum_sum[i] + A[i] ans = 0 for i in range(1 << M): w = v = 0 for j in range(M): if i >> j & 1: w += B[j] v += C[j] if w > W: continue ans = max(ans, v + cum_sum[min(N, W - w)]) print(ans)