結果
| 問題 |
No.2730 Two Types Luggage
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-03 10:22:52 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,061 bytes |
| コンパイル時間 | 3,266 ms |
| コンパイル使用メモリ | 262,208 KB |
| 実行使用メモリ | 814,620 KB |
| 最終ジャッジ日時 | 2024-11-24 09:31:18 |
| 合計ジャッジ時間 | 37,623 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 MLE * 28 |
ソースコード
#pragma GCC optimize("O3")
#ifdef LOCAL
#include "algo/debug_ver3.hpp"
#else
#define debug(...)
#define debugArr(...)
#endif
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n, m;
long long w;
cin >> n >> m >> w;
vector<long long> 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];
vector<vector<long long>> dp(n + 1, vector<long long>(n + 1));
for (int i = 0; i < n; ++i) for (int j = 0; j <= n; ++j) {
if (j + 1 <= n) dp[i][j + 1] = max(dp[i][j + 1], dp[i][j]);
if (j + 1 <= n) dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + a[i]);
dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
}
long long res = 0;
for (int bit = 0; bit < 1 << m; ++bit) {
long long weight = 0, value = 0;
for (int i = 0; i < m; ++i) if (bit & 1 << i) weight += b[i], value += c[i];
if (weight > w) continue;
res = max(res, value + dp[n][min(w - weight, (long long)(n))]);
}
cout << res << '\n';
}