답안 #1066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1066 2013-06-23T01:42:27 Z tncks0121 앱 (KOI13_app) C++
21 / 21
4 ms 5192 KB
#include<stdio.h>
FILE *in=stdin;
FILE *out=stdout;

int n, m;
int memory[105], cost[105], d[105][10005];
int dab;
int main () {
int t, i, j;
fscanf(in, "%d%d", &n, &m);
for (i=1;i<=n;i++)
fscanf(in, "%d", &memory[i]);
for (i=1;i<=n;i++)
fscanf(in, "%d", &cost[i]);
for (i=0;i<=10000;i++)
d[0][i] = 0;
for (i=1;i<=n;i++) {
for (j=0;j<=10000;j++) {
d[i][j] = d[i-1][j];
if (j-cost[i] >= 0 && d[i][j] <
d[i-1][j-cost[i]]+memory[i])
d[i][j] = d[i-1][j-cost[i]]+memory[i];
}
}
dab = -1;
for (i=0;i<=10000;i++) {
if (d[n][i] >= m) {
dab = i;
break;
}
}fprintf(out, "%d\n", dab);
return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5192 KB Output is correct
2 Correct 0 ms 5192 KB Output is correct
3 Correct 0 ms 5192 KB Output is correct
4 Correct 0 ms 5192 KB Output is correct
5 Correct 0 ms 5192 KB Output is correct
6 Correct 0 ms 5192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5192 KB Output is correct
2 Correct 0 ms 5192 KB Output is correct
3 Correct 0 ms 5192 KB Output is correct
4 Correct 0 ms 5192 KB Output is correct
5 Correct 0 ms 5192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5192 KB Output is correct
2 Correct 0 ms 5192 KB Output is correct
3 Correct 0 ms 5192 KB Output is correct
4 Correct 0 ms 5192 KB Output is correct
5 Correct 0 ms 5192 KB Output is correct
6 Correct 0 ms 5192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 5192 KB Output is correct
2 Correct 0 ms 5192 KB Output is correct
3 Correct 0 ms 5192 KB Output is correct
4 Correct 0 ms 5192 KB Output is correct
5 Correct 0 ms 5192 KB Output is correct
6 Correct 0 ms 5192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5192 KB Output is correct
2 Correct 0 ms 5192 KB Output is correct
3 Correct 0 ms 5192 KB Output is correct
4 Correct 4 ms 5192 KB Output is correct
5 Correct 0 ms 5192 KB Output is correct
6 Correct 0 ms 5192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5192 KB Output is correct
2 Correct 0 ms 5192 KB Output is correct
3 Correct 0 ms 5192 KB Output is correct
4 Correct 4 ms 5192 KB Output is correct
5 Correct 0 ms 5192 KB Output is correct
6 Correct 0 ms 5192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5192 KB Output is correct
2 Correct 4 ms 5192 KB Output is correct
3 Correct 4 ms 5192 KB Output is correct
4 Correct 4 ms 5192 KB Output is correct