結果
| 問題 |
No.2730 Two Types Luggage
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-05 09:28:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 289 ms / 2,000 ms |
| コード長 | 739 bytes |
| コンパイル時間 | 2,077 ms |
| コンパイル使用メモリ | 200,432 KB |
| 最終ジャッジ日時 | 2025-02-21 10:58:05 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
ll n, m, w, ans = 0;
cin >> n >> m >> w;
vector<ll> a(n), b(m), c(m), s(n + 1);
for(auto &&v : a) cin >> v;
for(auto &&v : b) cin >> v;
for(auto &&v : c) cin >> v;
sort(a.rbegin(), a.rend());
for(int i = 0; i < n; i++){
s[i + 1] = s[i] + a[i];
}
for(int S = 0; S < (1 << m); S++){
ll bs = 0, cs = 0;
for(int i = 0; i < m; i++){
if(S >> i & 1){
bs += b[i];
cs += c[i];
}
}
if(bs > w) continue;
ans = max(ans, s[min(n, w - bs)] + cs);
}
cout << ans << '\n';
}