Submission #336726

#TimeUsernameProblemLanguageResultExecution timeMemory
336726northlakeJelly Flavours (IOI20_jelly)C++17
44 / 100
2185 ms1602176 KiB
#include<bits/stdc++.h> #include<jelly.h> using namespace std; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n = a.size(); vector<vector<vector<int>>> knapsack {}; for (int i = 0; i < n+1; i++) { knapsack.push_back({}); for (int j = 0; j < x+1; j++) { knapsack[i].push_back({}); for (int k = 0; k < y+1; k++) { knapsack[i][j].push_back(0); } } } for (int i = 0; i < n+1; i++) { for (int j = 0; j < x+1; j++) { for (int k = 0; k < y+1; k++) { int current_jelly = i-1; int a_value = 0; int b_value = 0; int o_value = 0; if ((i-1)>=0 && (j-a[current_jelly])>=0) { a_value = knapsack[i-1][j-a[current_jelly]][k] + 1; } if ((i-1)>=0 && (k-b[current_jelly])>=0) { b_value = knapsack[i-1][j][k-b[current_jelly]] + 1; } if ((i-1)>=0) { o_value = knapsack[i-1][j][k]; } int value = max(max(0, o_value), max(a_value, b_value)); knapsack[i][j][k] = value; } } } return knapsack[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...