| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1020937 | urejgi | Knapsack (NOI18_knapsack) | C++17 | 1052 ms | 4040 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 <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
int s, n; cin >> s >> n;
vector<int> v(n), w(n), c(n);
for (int i = 0; i < n; ++i) {
cin >> v[i] >> w[i] >> c[i];
}
vector<int> dp(s + 1, 0);
for (int i = 0; i < n; ++i) {
for (int j = s; j >= 0; --j) {
for (int l = 1; l <= c[i] && l*w[i] <= j; ++l) {
dp[j] = max(dp[j], dp[j - l * w[i]] + l * v[i]);
}
}
}
cout << dp[s] << '\n';
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... | ||||
