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;
int find_maximum_unique(int x, int y, vector<int>a, vector<int>b) {
const int n = (int)a.size();
vector<vector<vector<int>>>dp(n+1, vector<vector<int>>(x+1, vector<int>(y+1, 0)));
int ans = 0;
for(int i = 1 ; i <= n ; i++) {
for(int j = 0 ; j <= x ; j++) {
for(int k = 0 ; k <= y ; k++) {
dp[i][j][k] = max(dp[i][j][k], dp[i-1][j][k]);
if(j >= a[i-1])
dp[i][j][k] = max(dp[i][j][k], 1 + dp[i-1][j - a[i-1]][k]);
if(k >= b[i-1])
dp[i][j][k] = max(dp[i][j][k], 1 + dp[i-1][j][k - b[i-1]]);
ans = max(ans, dp[i][j][k]);
}
}
}
return ans;
}
# | 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... |