Submission #14697

#TimeUsernameProblemLanguageResultExecution timeMemory
14697ansol4328앱 (KOI13_app)C++98
21 / 21
4 ms5068 KiB
#include<stdio.h> #include<stdlib.h> int dp[102][10002]; int main() { int i, j, n, need, m[102][4]; scanf("%d %d",&n,&need); for(i=1 ; i<=n ; i++) scanf("%d",&m[i][1]); for(i=1 ; i<=n ; i++) scanf("%d",&m[i][2]); for(i=1 ; i<=n ; i++) { for(j=1 ; j<=10000 ; j++) dp[i][j]=dp[i-1][j]; for(j=1 ; j<=10000 ; j++) { if(j-m[i][2]>=0) { if(dp[i][j]<dp[i-1][j-m[i][2]]+m[i][1]) dp[i][j]=dp[i-1][j-m[i][2]]+m[i][1]; } } } for(j=1 ; j<=10000 ; j++) { for(i=1 ; i<=n ; i++) { if(dp[i][j]>=need) { printf("%d",j); exit(1); } } } 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...