제출 #856569

#제출 시각아이디문제언어결과실행 시간메모리
856569bad_ianKnapsack (NOI18_knapsack)C++17
37 / 100
1063 ms348 KiB
#include <bits/stdc++.h> typedef long long ll; using namespace std; int main() { ll S, N; cin >> S >> N; vector<ll> dp(S + 1, 0); for (int i = 0; i < N; i++) { ll V, W, K; cin >> V >> W >> K; for (int k = 1; k <= K; k++) { for (int s = S; s >= W; s--) { dp[s] = max(dp[s], dp[s - W] + V); } } } cout << dp[S] << endl; return 0; }
#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...