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 <bits/stdc++.h>
#include "jelly.h"
using namespace std;
#define f first
#define s second
vector<pair<int,int>>v;
int N;
int dfs(int i, int x, int y) {
if(i == N)
return 0;
int ret = 0;
if(x >= v[i].f)
ret = max(ret, 1 + dfs(i+1, x - v[i].f, y));
if(y >= v[i].s)
ret = max(ret, 1 + dfs(i+1, x, y - v[i].s));
ret = max(ret, dfs(i+1,x,y));
return ret;
}
int find_maximum_unique(int x, int y, vector<int>a, vector<int>b) {
N = (int)a.size();
v.resize(N);
for(int i = 0 ; i < N ; i++)
v[i].f = a[i], v[i].s = b[i];
return dfs(0, x, y);
}
# | 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... |