답안 #18284

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18284 2016-01-26T12:00:57 Z mindol 앱 (KOI13_app) C++
21 / 21
2 ms 5028 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5028 KB Output is correct
2 Correct 0 ms 5028 KB Output is correct
3 Correct 0 ms 5028 KB Output is correct
4 Correct 0 ms 5028 KB Output is correct
5 Correct 0 ms 5028 KB Output is correct
6 Correct 0 ms 5028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5028 KB Output is correct
2 Correct 0 ms 5028 KB Output is correct
3 Correct 0 ms 5028 KB Output is correct
4 Correct 0 ms 5028 KB Output is correct
5 Correct 0 ms 5028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5028 KB Output is correct
2 Correct 0 ms 5028 KB Output is correct
3 Correct 0 ms 5028 KB Output is correct
4 Correct 0 ms 5028 KB Output is correct
5 Correct 0 ms 5028 KB Output is correct
6 Correct 0 ms 5028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5028 KB Output is correct
2 Correct 0 ms 5028 KB Output is correct
3 Correct 0 ms 5028 KB Output is correct
4 Correct 0 ms 5028 KB Output is correct
5 Correct 0 ms 5028 KB Output is correct
6 Correct 0 ms 5028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5028 KB Output is correct
2 Correct 0 ms 5028 KB Output is correct
3 Correct 0 ms 5028 KB Output is correct
4 Correct 0 ms 5028 KB Output is correct
5 Correct 0 ms 5028 KB Output is correct
6 Correct 0 ms 5028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5028 KB Output is correct
2 Correct 0 ms 5028 KB Output is correct
3 Correct 0 ms 5028 KB Output is correct
4 Correct 0 ms 5028 KB Output is correct
5 Correct 0 ms 5028 KB Output is correct
6 Correct 0 ms 5028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5028 KB Output is correct
2 Correct 0 ms 5028 KB Output is correct
3 Correct 2 ms 5028 KB Output is correct
4 Correct 0 ms 5028 KB Output is correct