Submission #16244

#TimeUsernameProblemLanguageResultExecution timeMemory
16244eaststar앱 (KOI13_app)C++14
21 / 21
1 ms1124 KiB
#include <stdio.h> #include <algorithm> using namespace std; struct Data{ int m,c; }a[110]; int D[10101],s; int main(){ int i,j,n,m; scanf("%d%d",&n,&m); for(i=1;i<=n;++i)scanf("%d",&a[i].m); for(i=1;i<=n;++i){ scanf("%d",&a[i].c); s+=a[i].c; } D[0]=1; for(i=1;i<=n;++i){ for(j=s;j>=a[i].c;--j){ if(D[j-a[i].c])D[j]=max(D[j],D[j-a[i].c]+a[i].m); } } for(i=1;i<=s;++i)if(D[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...