結果
| 問題 | No.2730 Two Types Luggage |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-21 09:44:53 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 383 ms / 2,000 ms |
| + 439µs | |
| コード長 | 617 bytes |
| 記録 | |
| コンパイル時間 | 3,290 ms |
| コンパイル使用メモリ | 188,228 KB |
| 実行使用メモリ | 18,896 KB |
| 最終ジャッジ日時 | 2026-10-21 09:46:41 |
| 合計ジャッジ時間 | 16,124 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge6_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(void){
ll n, m, w; cin >> n >> m >> w;
vector<ll> a(n), b(m), c(m);
for(auto&x:a) cin >> x;
for(auto&x:b) cin >> x;
for(auto&x:c) cin >> x;
sort(rbegin(a), rend(a));
vector<ll> suma(n+1);
for(int i=0; i<n; i++) suma[i+1]=suma[i]+a[i];
ll ans=0, mx=(1<<m);
for(int i=0; i<mx; i++){
ll nw=0, v=0;
for(int j=0; j<m; j++)if(i>>j&1){
nw+=b[j], v+=c[j];
}
if(nw>w) continue;
ll rem=min(n, w-nw);
ans=max(ans, v+suma[rem]);
}
cout << ans << endl;
return 0;
}