| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1172365 | kanatbekabi | Knapsack (NOI18_knapsack) | C++20 | 0 ms | 400 KiB |
#include <bits/stdc++.h>
using namespace std;
const int x = 10004;
const int y = 2004;
int n, m, w[x] , a[x] , v[x];
int dp[y];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n >> m;
int ans = 0;
for (int i = 0; i < m; i++){
cin >> a[i] >> w[i]>> v[i];
for (int k = n; k >= w[i]; k--){
dp[k] = max(dp[k] , dp[k - w[i]] + a[i]);
}
}
for (int i = 1; i <= n; i++){
ans = max(ans , dp[i]);
}
cout << ans;
}| # | 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... | ||||
