답안 #16244

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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