| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1131563 | mestive | Knapsack (NOI18_knapsack) | C++20 | 1093 ms | 33148 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 998244353
#define ln '\n'
struct Item {
int value;
int weight;
};
int main() {
// ios::sync_with_stdio(0);
// cin.tie(0);
int s{}, n{};
cin >> s >> n;
int v{}, w{}, k{};
vector<Item> items;
for (int i = 0; i < n; ++i) {
cin >> v >> w >> k;
for (int j = 0; j < k; ++j) {
items.push_back({v, w});
}
}
vector<int> dp(s+1, 0);
for (Item item : items) {
for (int j = s; j >= item.weight; j--) {
dp[j] = max(dp[j], dp[j - item.weight] + item.value);
}
}
cout << dp[s] << ln;
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... | ||||
