Submission #434273

#TimeUsernameProblemLanguageResultExecution timeMemory
434273madlogicJelly Flavours (IOI20_jelly)C++17
0 / 100
2085 ms344 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 = (int) a.size(); vector<pair<int, int>> jellies(n); for (int i = 0; i < n; i++) { jellies[i].first = a[i]; jellies[i].second = b[i]; } sort(jellies.begin(), jellies.end()); int res = 0; for (int i = 0; i < n; i++) { int sum = 0; for (int j = i; j < n; j++) { if (sum + jellies[j].first > x) { break; } sum += jellies[j].first; int cur = j - i + 1; vector<int> rem; for (int k = 0; k < n; k++) { if (k >= i && k <= j) { continue; } rem.push_back(jellies[k].second); } sort(rem.begin(), rem.end()); int tmp = y; for (int& cost : rem) { if (tmp - cost >= 0) { tmp -= cost; ++cur; } } res = max(res, cur); } } return res; }
#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...