Submission #7893

#TimeUsernameProblemLanguageResultExecution timeMemory
7893paulsohn앱 (KOI13_app)C++98
6.30 / 21
1000 ms1088 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...