Submission #7893

# Submission time Handle Problem Language Result Execution time Memory
7893 2014-08-23T15:21:22 Z paulsohn 앱 (KOI13_app) C++
6.3 / 21
1000 ms 1088 KB
#include<stdio.h>
int N, M, m[100] = { 0 }, c[100] = { 0 };
int cost(int i, int mem){
	int used, unused;
	if (i == N - 1){
		if (mem > m[N - 1]) return 10001;
		if (mem <= 0) return 0;
		return c[N - 1];
	}
	used = c[i]+cost(i + 1, mem - m[i]);
	unused = cost(i + 1, mem);
	if (used > unused) return unused;
	return used;
}
int main(){
	int i;
	scanf("%d %d", &N, &M);
	for (i = 0; i < N; ++i) scanf("%d", &m[i]);
	for (i = 0; i < N; ++i) scanf("%d", &c[i]);
	printf("%d\n", cost(0,M));
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
6 Correct 4 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1084 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1088 KB Output is correct
2 Execution timed out 1000 ms 1084 KB Program timed out
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1084 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1084 KB Program timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1084 KB Program timed out
2 Halted 0 ms 0 KB -