結果
| 問題 |
No.2730 Two Types Luggage
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-19 21:42:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 273 ms / 2,000 ms |
| コード長 | 1,087 bytes |
| コンパイル時間 | 2,071 ms |
| コンパイル使用メモリ | 198,396 KB |
| 最終ジャッジ日時 | 2025-02-21 03:58:21 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
#define INF 1000000001LL
#define LNF 1000000000000000001LL
#define MOD 998244353LL
#define MAX 1005
#define long long long
#define all(x) x.begin(),x.end()
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
long n,m,w;
cin >> n >> m >> w;
vector<long> a(n);
vector<long> b(n);
vector<long> c(n);
vector<long> hap(n+1);
for(int i = 0; i<n ;i++)
cin >> a[i];
for(int i = 0; i<m ;i++)
cin >> b[i];
for(int i = 0; i<m ;i++)
cin >> c[i];
sort(all(a));
reverse(all(a));
for(int i = 0; i<n; i++)
hap[i+1] = hap[i]+a[i];
long res = 0;
for(int i = 0; i<1<<m; i++)
{
long curW = 0;
long curV = 0;
for(int j = 0; j<m; j++)
{
if(i&(1<<j))
{
curW+=b[j];
curV+=c[j];
}
}
if(curW > w)
continue;
curV+=hap[min(n,w-curW)];
res = max(res,curV);
}
cout << res << endl;
return 0;
}