제출 #1326041

#제출 시각아이디문제언어결과실행 시간메모리
1326041c0d3xx_Knapsack (NOI18_knapsack)C++20
0 / 100
1 ms428 KiB
#include <bits/stdc++.h> #define maxn 1003 #define pii pair<ll, ll> #define tpe tuple<int, int, int> #define MOD 1000000007 #define ll long long #define lim 44725 #define file "mind" #define base 131 using namespace std; int n, c; ll d[maxn][maxn]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> c; for(int i = 1; i <= n; i++) { int w, v, k; cin >> w >> v >> k; for(int j = 0; j <= c; j++) { d[i][j] = d[i-1][j]; for(int t = 1; t <= k; t++) { if(j >= w * t) d[i][j] = max(d[i][j], d[i-1][j-w*t] + v * t); } } } cout << d[n][c]; }
#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...