| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1303265 | kill3_cro | Knapsack (NOI18_knapsack) | C++20 | 1086 ms | 584 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, s;
cin >> s >> n;
vector<int> dp(s+1, -1);
dp[0] = 0;
for (int i = 0; i < n; i++) {
int value, weight, m;
cin >> value >> weight >> m;
while (m--) {
for (int j = s; j >= weight; j--) {
dp[j] = max(dp[j], dp[j-weight] + value);
}
}
}
cout << *max_element(dp.begin(), dp.end());
}| # | 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... | ||||
