Submission #16244

# Submission time Handle Problem Language Result Execution time Memory
16244 2015-08-18T11:19:48 Z eaststar 앱 (KOI13_app) C++14
21 / 21
1 ms 1124 KB
#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 time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct
5 Correct 0 ms 1124 KB Output is correct
6 Correct 0 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct
5 Correct 0 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct
5 Correct 0 ms 1124 KB Output is correct
6 Correct 0 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct
5 Correct 0 ms 1124 KB Output is correct
6 Correct 0 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 1 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct
5 Correct 1 ms 1124 KB Output is correct
6 Correct 0 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 1 ms 1124 KB Output is correct
5 Correct 1 ms 1124 KB Output is correct
6 Correct 0 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1124 KB Output is correct
2 Correct 0 ms 1124 KB Output is correct
3 Correct 0 ms 1124 KB Output is correct
4 Correct 0 ms 1124 KB Output is correct