Submission #18284

#TimeUsernameProblemLanguageResultExecution timeMemory
18284mindol앱 (KOI13_app)C++98
21 / 21
2 ms5028 KiB
#include<cstdio> #include<algorithm> using namespace std; int dt[101][10001]; // dt[i][j] : A1~Ai 까지의 앱 중에서 볼 때 비용 j를 써서 얻을 수 있는 최대 메모리 int m[101],c[101]; int main() { int N,M,totc=0; 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]),totc+=c[i]; for(int i=1;i<=N;i++) for(int j=0;j<=totc;j++) { if(j<c[i]) dt[i][j]=dt[i-1][j]; else dt[i][j]=max(dt[i-1][j],dt[i-1][j-c[i]]+m[i]); } for(int i=0;i<=totc;i++) for(int j=1;j<=N;j++) if(dt[j][i]>=M) { printf("%d",i); return 0; } 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...