#include <bits/stdc++.h>
#include "jelly.h"
using namespace std;
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
int n = a.size();
reverse(a.begin(), a.end()); a.emplace_back(0); reverse(a.begin(), a.end());
reverse(b.begin(), b.end()); b.emplace_back(0); reverse(b.begin(), b.end());
int dp[n + 1][x + 1][y + 1]; memset(dp, 0, sizeof dp);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= x; j++) {
for (int k = 1; k <= y; k++) {
dp[i][j][k] = dp[i - 1][j][k];
if (j > a[i]) dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j - a[i]][k] + 1);
if (k > b[i]) dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j][k - b[i]] + 1);
}
}
}
return dp[n][x][y];
}
/*
sub 1-2: constraints
dp[i][j][k] = max ans when we used i at a, j at b, checked up to k
answer is at dp[x][y][n]
sub 3: cannot buy from b (only from a)
greedy stupid
sub 4: b is all equal
greedy stupid again
sub 5: a and b are same
*/
| # | 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... |