| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1355010 | kmath628 | Knapsack (NOI18_knapsack) | C++20 | 1095 ms | 440 KiB |
#include <bits/stdc++.h>
using namespace std;
int dp[2][2001];
int main(){
int s,n,v,w,k,i,j,j2,mx=0;
scanf("%d %d",&s,&n);
for(i=1;i<=n;i++){
scanf("%d %d %d",&v,&w,&k);
for(j=0;j<=s;j++){
for(j2=0;j2<=min(j/w,k);j2++){
dp[i%2][j]=max(dp[i%2][j],dp[(i-1)%2][j-w*j2]+v*j2);
}
mx=max(mx,dp[i%2][j]);
}
}
printf("%d\n",mx);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
