# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
3140 |
2013-08-26T07:44:46 Z |
club4208 |
앱 (KOI13_app) |
C++ |
|
4 ms |
5032 KB |
#include <stdio.h>
#define INF 10000001
int d[101][10001];
int m[101], cost[101], n, memory;
int max(int a, int b){
if(a<b) return b;
else return a;
}
int main(){
//freopen("input.txt", "r", stdin);
//freopen("output.txt', "w", stdout);
int i, j, sum=0, res=INF;
scanf("%d %d", &n, &memory);
for(i=1;i<=n;i++) scanf("%d", &m[i]);
for(i=1;i<=n;i++){ scanf("%d", &cost[i]); sum+=cost[i]; }
for(i=1;i<=n;i++){
for(j=0;j<=sum;j++){
int a=j-cost[i];
d[i][j]=d[i][j-1];
if(a>=0) d[i][j]=max(d[i-1][a]+m[i], d[i][j]);
if(i>0) d[i][j]=max(d[i][j], d[i-1][j]);
if(d[i][j]>=memory && res>=j) res=j;
}
}
printf("%d", res);
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 |
0 ms |
5032 KB |
Output is correct |
2 |
Correct |
0 ms |
5032 KB |
Output is correct |
3 |
Correct |
4 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 |
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 |
4 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 |
0 ms |
5032 KB |
Output is correct |