結果
| 問題 | No.2730 Two Types Luggage |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-19 22:45:33 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 206 ms / 2,000 ms |
| コード長 | 818 bytes |
| 記録 | |
| コンパイル時間 | 1,520 ms |
| コンパイル使用メモリ | 222,804 KB |
| 実行使用メモリ | 20,220 KB |
| 最終ジャッジ日時 | 2026-07-04 13:26:35 |
| 合計ジャッジ時間 | 6,934 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include <bits/stdc++.h>
typedef long long LL;
typedef __int128 LLL;
const int N = 10;
const int MOD = 998244353;
int main() {
int n, m;
LL k;
scanf("%d%d%lld", &n, &m, &k);
std::vector<LL> a(n);
for(LL &v: a)
scanf("%lld", &v);
std::sort(a.begin(), a.end(), std::greater<LL>());
a.insert(a.begin(), 0);
for(int i = 1; i < a.size(); ++i)
a[i] += a[i - 1];
std::vector<std::pair<int, int>> b(m);
for(auto &[x, y]: b)
scanf("%d", &y);
for(auto &[x, y]: b)
scanf("%d", &x);
LL ans = 0;
for(int i = 0; i < (1 << m); ++i) {
LL v = 0, w = 0;
for(int j = 0; j < m; ++j)
if(i >> j & 1)
v += b[j].first, w += b[j].second;
if(w <= k)
ans = std::max(ans, v + (k - w < a.size() ? a[k - w] : a.back()));
}
printf("%lld\n", ans);
return 0;
}