結果
| 問題 | No.2730 Two Types Luggage |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-19 21:23:32 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 195 ms / 2,000 ms |
| コード長 | 775 bytes |
| 記録 | |
| コンパイル時間 | 2,237 ms |
| コンパイル使用メモリ | 339,716 KB |
| 実行使用メモリ | 19,460 KB |
| 最終ジャッジ日時 | 2026-04-27 22:13:49 |
| 合計ジャッジ時間 | 7,589 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long n,m,w;
cin >> n >> m >> w;
vector<long long> a(n);
vector<long long> b(m),c(m);
for(auto &nx : a){cin >> nx;}
for(auto &nx : b){cin >> nx;}
for(auto &nx : c){cin >> nx;}
sort(a.begin(),a.end());
reverse(a.begin(),a.end());
vector<long long> s={0};
for(auto &nx : a){
s.push_back(s.back()+nx);
}
long long res=0;
for(long long i=0;i<(1ll<<m);i++){
long long cres=0,cw=0;
for(long long j=0;j<m;j++){
if(i&(1ll<<j)){
cres+=c[j];
cw+=b[j];
}
}
cw = w - cw;
if(cw>=0){
res=max(res,cres+s[min((long long)(s.size()-1),cw)]);
}
}
cout << res << "\n";
return 0;
}