Submission #983694

#TimeUsernameProblemLanguageResultExecution timeMemory
983694gustavo_dJelly Flavours (IOI20_jelly)C++17
10 / 100
1 ms756 KiB
#include "jelly.h" #include <bits/stdc++.h> using namespace std; int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) { int n = a.size(); if (n*x*y <= 5e7+100 and false) { vector<vector<vector<int>>> dp(n+1, vector<vector<int>> (x+1, vector<int> (y+1, 0))); for (int i=1; i<=n; i++) { for (int xi=0; xi<=x; xi++) { for (int yi=0; yi<=y; yi++) { // não compra e pega o xi ou yi menor dp[i][xi][yi] = max(0, dp[i][xi != 0 ? xi-1 : 0][yi]); dp[i][xi][yi] = max(dp[i][xi][yi], dp[i][xi][yi != 0 ? yi-1 : 0]); // não compra o i dp[i][xi][yi] = max(dp[i][xi][yi], dp[i-1][xi][yi]); // compra na a if (xi >= a[i-1]) dp[i][xi][yi] = max(dp[i][xi][yi], dp[i-1][xi-a[i-1]][yi] + 1); // compra na b if (yi >= b[i-1]) dp[i][xi][yi] = max(dp[i][xi][yi], dp[i-1][xi][yi-b[i-1]] + 1); } } } return dp[n][x][y]; } else { int cnt = 0, i=0; sort(a.begin(), a.end()); for (; i<n; i++, cnt++) { // acha primeiro que não pode comprar if (x < a[i]) break; x -= a[i]; } for (; i<n; i++, cnt++) { if (y<b[i]) break; y-=b[i]; } return cnt; } }
#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...