#include "jelly.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
#define pb push_back
#define st first
#define nd second
const int MAXA = 1e4 + 7;
struct pam {
int wyn;
int suma;
};
pam dp[MAXA];
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) {
int n = a.size();
rep(i, MAXA) {
dp[i] = {0, 0};
}
rep(i, n) {
for (int j = MAXA - 1; j >= 0; j--) {
if (j < a[i]) {
if (dp[j].suma + b[i] <= y) {
dp[j] = {dp[j].wyn + 1, dp[j].suma + b[i]};
}
}
else {
if (dp[j].suma + b[i] <= y) {
dp[j] = {dp[j].wyn + 1, dp[j].suma + b[i]};
}
if (dp[j - a[i]].wyn + 1 > dp[j].wyn) {
dp[j].wyn = dp[j - a[i]].wyn + 1;
}
else if (dp[j - a[i]].wyn + 1 == dp[j].wyn) {
dp[j].suma = min(dp[j].suma, dp[j - a[i]].suma);
}
}
}
}
return dp[x].wyn;
}
# | 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... |