Submission #5069

# Submission time Handle Problem Language Result Execution time Memory
5069 2014-01-31T06:23:25 Z Namnamseo 앱 (KOI13_app) C++
21 / 21
4 ms 5032 KB
#include <stdio.h>

int dyn[101][10001];

int max(int a,int b) { 
    return (a>b)?a:b;
}

int main()
{
    int n,m;
    int i,j;
    int memo[101],cost[101];
    scanf("%d%d",&n,&m);
    for(i=1;i<=n;i++) scanf("%d",&memo[i]);
    for(i=1;i<=n;i++) scanf("%d",&cost[i]);
    for(i=1;i<=n;i++){
        for(j=0;j<cost[i];j++) dyn[i][j]=dyn[i-1][j];
        for(j=cost[i];j<=10000;j++){
            dyn[i][j]=max(dyn[i-1][j],dyn[i-1][j-cost[i]]+memo[i]);
        }
    }
    for(i=0;i<=10000;i++) if(dyn[n][i]>=m) break;
    printf("%d",i);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5032 KB Output is correct
2 Correct 0 ms 5032 KB Output is correct
3 Correct 0 ms 5032 KB Output is correct
4 Correct 0 ms 5032 KB Output is correct
5 Correct 0 ms 5032 KB Output is correct
6 Correct 0 ms 5032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5032 KB Output is correct
2 Correct 0 ms 5032 KB Output is correct
3 Correct 0 ms 5032 KB Output is correct
4 Correct 0 ms 5032 KB Output is correct
5 Correct 0 ms 5032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5032 KB Output is correct
2 Correct 0 ms 5032 KB Output is correct
3 Correct 0 ms 5032 KB Output is correct
4 Correct 0 ms 5032 KB Output is correct
5 Correct 0 ms 5032 KB Output is correct
6 Correct 0 ms 5032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5032 KB Output is correct
2 Correct 0 ms 5032 KB Output is correct
3 Correct 0 ms 5032 KB Output is correct
4 Correct 0 ms 5032 KB Output is correct
5 Correct 0 ms 5032 KB Output is correct
6 Correct 0 ms 5032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5032 KB Output is correct
2 Correct 0 ms 5032 KB Output is correct
3 Correct 0 ms 5032 KB Output is correct
4 Correct 0 ms 5032 KB Output is correct
5 Correct 0 ms 5032 KB Output is correct
6 Correct 0 ms 5032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5032 KB Output is correct
2 Correct 0 ms 5032 KB Output is correct
3 Correct 0 ms 5032 KB Output is correct
4 Correct 4 ms 5032 KB Output is correct
5 Correct 0 ms 5032 KB Output is correct
6 Correct 0 ms 5032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5032 KB Output is correct
2 Correct 4 ms 5032 KB Output is correct
3 Correct 0 ms 5032 KB Output is correct
4 Correct 4 ms 5032 KB Output is correct