이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "jelly.h"
using namespace std;
#define ve vector
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 10;
int find_maximum_unique(int x, int y, ve<int> A, ve<int> B) {
int n = (int)A.size();
ve<ve<ve<int>>> DP(n + 1, ve<ve<int>>(x + 1, ve<int>(y + 1, -1)));
DP[0][0][0] = 0;
for (int i = 1; i <= n; i++) {
for (int j = 0; j <= x; j++) {
for (int k = 0; k <= y; k++) {
int v1 = DP[i - 1][j][k];
int v2 = -1;
int v3 = -1;
if (j - A[i - 1] >= 0) {
int v = DP[i - 1][j - A[i - 1]][k];
if (v != -1) v2 = v + 1;
}
if (k - B[i - 1] >= 0) {
int v = DP[i - 1][j][k - B[i - 1]];
if (v != -1) v2 = v + 1;
}
DP[i][j][k] = max(v1, max(v2, v3));
}
}
}
int ans = 0;
for (int j = 0; j <= x; j++) {
for (int k = 0; k <= y; k++) {
ans = max(ans, DP[n][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... |