# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
944497 | rainboy | 앱 (KOI13_app) | C11 | 2 ms | 600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <string.h>
#define N 100
#define C 100
#define S (N * C)
int max(int a, int b) { return a > b ? a : b; }
int main() {
static int ww[N], cc[N], dp[S + 1];
int n, m, i, s;
scanf("%d%d", &n, &m);
for (i = 0; i < n; i++)
scanf("%d", &ww[i]);
for (i = 0; i < n; i++)
scanf("%d", &cc[i]);
memset(dp, -1, (S + 1) * sizeof *dp), dp[0] = 0;
for (i = 0; i < n; i++)
for (s = S; s >= 0; s--)
if (dp[s] != -1)
dp[s + cc[i]] = max(dp[s + cc[i]], dp[s] + ww[i]);
s = 0;
while (dp[s] < m)
s++;
printf("%d\n", s);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |