| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1023733 | vjudge1 | Knapsack (NOI18_knapsack) | C++17 | 0 ms | 348 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>
#include <vector>
using namespace std;
int main() {
int N, S;
cin >> N >> S;
vector<int> dp(S + 1, 0);
for (int i = 0; i < N; ++i) {
int V, W, K;
cin >> V >> W >> K;
for (int k = 1; K > 0; k <<= 1) {
int count = min(k, K);
K -= count;
int weight = W * count;
int value = V * count;
for (int s = S; s >= weight; --s) {
dp[s] = max(dp[s], dp[s - weight] + value);
}
}
}
cout << dp[S] << endl;
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... | ||||
