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 <bits/stdc++.h>
using namespace std;
int main() {
int s, n;
cin >> s >> n;
vector<int> dp(s+1, 0);
for (int i = 0; i < n; i++) {
int v, w, k;
cin >> v >> w >> k;
for (int j = 0; j < k; j++) {
for (int r = s; r >= w; r--) {
if (dp.at(r) < dp.at(r-w) + v) {
dp[r] = dp.at(r-w) + v;
}
}
}
}
cout << dp.at(s) << "\n";
}
# | 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... |