# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
330109 | Agnimandur | Jelly Flavours (IOI20_jelly) | Java | 526 ms | 241500 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.
import java.util.*;
class jelly {
int find_maximum_unique(int x, int y, int[] a, int[] b) {
int N = a.length;
int[][] vals = new int[N][2];
for (int i = 0; i < N; i++)
vals[i] = new int[] {a[i],b[i]};
sort(vals);
long[][] dpX = new long[N+1][x+1];
for (int i = 0; i < N; i++) {
for (int j = 0; j <= x; j++) {
//buy in shop2
dpX[i+1][j] = dpX[i][j]+vals[i][1];
//buy in shop1
if (j >= vals[i][0])
dpX[i+1][j] = Math.min(dpX[i+1][j],dpX[i][j-vals[i][0]]);
}
}
int[][] dpY = new int[N+1][y+1];
for (int i = N-1; i >= 0; i--) {
for (int j = 0; j <= y; j++) {
//dont take this jelly
dpY[i][j] = dpY[i+1][j];
//take this jelly
if (j >= vals[i][1])
# | 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... |