Submission #5069

#TimeUsernameProblemLanguageResultExecution timeMemory
5069Namnamseo앱 (KOI13_app)C++98
21 / 21
4 ms5032 KiB
#include <stdio.h> int dyn[101][10001]; int max(int a,int b) { return (a>b)?a:b; } int main() { int n,m; int i,j; int memo[101],cost[101]; scanf("%d%d",&n,&m); for(i=1;i<=n;i++) scanf("%d",&memo[i]); for(i=1;i<=n;i++) scanf("%d",&cost[i]); for(i=1;i<=n;i++){ for(j=0;j<cost[i];j++) dyn[i][j]=dyn[i-1][j]; for(j=cost[i];j<=10000;j++){ dyn[i][j]=max(dyn[i-1][j],dyn[i-1][j-cost[i]]+memo[i]); } } for(i=0;i<=10000;i++) if(dyn[n][i]>=m) break; printf("%d",i); 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...