# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
401320 | | hgmhc | 앱 (KOI13_app) | C++14 | | 5 ms | 4172 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
const int maxn = 100, maxp = 1e4;
int n, M, m[maxn+1], c[maxn+1], dp[maxn+1][maxp+1];
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> M;
for (int i = 1; i <= n; ++i) cin >> m[i];
for (int i = 1; i <= n; ++i) cin >> c[i];
for (int k = 1; k <= n; ++k) {
for (int p = 0; p <= maxp; ++p) {
dp[k][p] = dp[k-1][p];
if (p-c[k] >= 0)
dp[k][p] = max(dp[k][p], dp[k-1][p-c[k]]+m[k]);
}
}
for (int p = 0; p <= maxp; ++p) {
if (dp[n][p] >= M) {
cout << p;
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |