Submission #673018

#TimeUsernameProblemLanguageResultExecution timeMemory
673018Hacv16Jelly Flavours (IOI20_jelly)C++17
0 / 100
917 ms2097152 KiB
#include <bits/stdc++.h> #include "jelly.h" using namespace std; const int MAX = 2015; int n, a[MAX], b[MAX]; int find_maximum_unique(int x, int y, vector<int> _a, vector<int> _b) { n = _a.size(); for(int i = 1; i <= n; i++){ a[i] = _a[i - 1]; b[i] = _b[i - 1]; } assert(y != 0); if(y == 0){ sort(a + 1, a + 1 + n); int resp = 0, i = 1; while(x - a[i] >= 0){ x -= a[i]; resp++; i++; } return resp; } 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 j = 0; j <= x; j++){ for(int k = 0; k <= y; k++){ int cur = dp[i - 1][j][k]; if(j >= a[i]) cur = max(cur, dp[i - 1][j - a[i]][k] + 1); if(k >= b[i]) cur = max(cur, dp[i - 1][j][k - b[i]] + 1); dp[i][j][k] = cur; } } } return dp[n][x][y]; }
#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...