제출 #754765

#제출 시각아이디문제언어결과실행 시간메모리
754765asdasdqwerKnapsack (NOI18_knapsack)C++14
37 / 100
1075 ms316 KiB
#include <bits/stdc++.h> using namespace std; int main() { int s, n; cin >> s >> n; vector<int> dp(s+1, 0); for (int i = 0; i < n; i++) { int v, w, k; cin >> v >> w >> k; for (int j = 0; j < k; j++) { for (int r = s; r >= w; r--) { if (dp[r] < dp[r-w] + v) { dp[r] = dp[r-w] + v; } } } } cout << dp[s] << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...