답안 #2140

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
2140 2013-07-20T03:02:04 Z hana5505 앱 (KOI13_app) C++
21 / 21
0 ms 1128 KB
#include<stdio.h> 
int memo[101]; 
int cost[101]; 
int d[10001]; 
int main() 
{ 
    int n,m,i,j,s=0; 
  
    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]); 
  
    d[cost[1]]=memo[1]; 
    s=cost[1]; 
    d[0]=1; 
    for(i=2;i<=n;i++){ 
        for(j=s;j>=1;j--){ 
            if(d[j] && d[j+cost[i]]<d[j]+memo[i]) d[j+cost[i]]=d[j]+memo[i]; 
        } 
        if(d[cost[i]]<memo[i]) d[cost[i]]=memo[i]; 
        s+=cost[i]; 
        if(s>10000) s=10000; 
    } 
  
    for(i=1;i<=10000;i++){ 
        if(d[i]>=m) break; 
    } 
  
    printf("%d",i); 
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct
5 Correct 0 ms 1128 KB Output is correct
6 Correct 0 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct
5 Correct 0 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct
5 Correct 0 ms 1128 KB Output is correct
6 Correct 0 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct
5 Correct 0 ms 1128 KB Output is correct
6 Correct 0 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct
5 Correct 0 ms 1128 KB Output is correct
6 Correct 0 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct
5 Correct 0 ms 1128 KB Output is correct
6 Correct 0 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1128 KB Output is correct
2 Correct 0 ms 1128 KB Output is correct
3 Correct 0 ms 1128 KB Output is correct
4 Correct 0 ms 1128 KB Output is correct