# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37606 | 14kg | 앱 (KOI13_app) | C++11 | 723 ms | 40176 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 <algorithm>
#define INF 999999999
#define min2(x,y) (x<y?x:y)
using namespace std;
int n, m, d[10000001];
pair<int, int> in[101];
int main() {
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%d", &in[i].first);
in[i].first = min2(in[i].first, m);
}
for (int i = 1; i <= n; i++) scanf("%d", &in[i].second);
for (int i = 1; i <= m; i++) d[i] = INF;
for (int i = 1; i <= n; i++)
for (int j = m; j >= 0; j--)
d[min2(m,j + in[i].first)] = min2(d[min2(m,j + in[i].first)], d[j] + in[i].second);
printf("%d", d[m]);
}
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... |