Submission #1269416

#TimeUsernameProblemLanguageResultExecution timeMemory
1269416sepehrfazliiiKnapsack (NOI18_knapsack)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> using namespace std; int main() { int s, n; cin >> s >> n; int dp[s + 10]; for(int i = 0; i < n; i++) { int v , w , k; cin >> v >> w >> k; for (int j = s; j >= 0; j--) { for(int c = 1; c <= k and c * w <= j; c++) { dp[j] = max(dp[j] , dp[j - c * w] + c * v); } } } cout << dp[s] << endl; }
#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...