Submission #438883

#TimeUsernameProblemLanguageResultExecution timeMemory
438883Tc14Jelly Flavours (IOI20_jelly)C++17
44 / 100
1687 ms2097156 KiB
#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) v3 = 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...