Submission #7875

#TimeUsernameProblemLanguageResultExecution timeMemory
7875lingxiang앱 (KOI13_app)C++98
21 / 21
0 ms5396 KiB
#include<stdio.h> #include<algorithm> using namespace std; int D[105][10500]; int N,M,m[105],c[105]; int s; int ans=100000000; int input(); int solve(); int output(); int input(){ scanf("%d %d",&N,&M); for(int i=1;i<=N;i++)scanf("%d",&m[i]); for(int i=1;i<=N;i++){scanf("%d",&c[i]);s+=c[i];} return 0; } int solve(){ for(int i=1;i<=N;i++){ for(int j=1;j<=s;j++){ if(j<c[i]){ D[i][j]=D[i-1][j]; } else D[i][j]=max(D[i-1][j-c[i]]+m[i],D[i-1][j]); if(D[i][j]>=M) ans=min(ans,j); } } return 0; } int output(){ printf("%d",ans); return 0; } int main(){ input(); solve(); output(); 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...