結果
問題 |
No.2730 Two Types Luggage
|
ユーザー |
|
提出日時 | 2024-04-19 21:55:27 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,055 bytes |
コンパイル時間 | 3,297 ms |
コンパイル使用メモリ | 250,744 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-10-11 14:56:37 |
合計ジャッジ時間 | 15,446 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 TLE * 2 -- * 13 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int INF = 1<<30; const int MOD = 998244353; //const long long INF = 1LL<<60; using graph = vector<vector<int>>; using ll = long long; int main(){ ll n, m, w; cin >> n >> m >> w; vector<ll> a(n), b(m), c(m); 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(a.begin(), a.end(), greater<ll>()); ll ans = 0LL; for (int i=0; i < (1<<m); i++){ ll weight = 0; ll value = 0; bool flag = true; for (int j=0; j < m; j++){ if (i & (1<<j)){ weight += b[j]; value += c[j]; } if (weight > w){ flag = false; break; } } if (flag){ ll rem = w - weight; for (int i=0; i < min(rem, n); i++){ value += a[i]; } ans = max(ans, value); } } cout << ans << endl; }