Submission #338461

#TimeUsernameProblemLanguageResultExecution timeMemory
338461northlakeJelly Flavours (IOI20_jelly)C++17
0 / 100
1 ms380 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(); int counter = 0; int answer = 0; vector<int> uebersprungene = {}; if (x > y) swap(x, y); sort(a.begin(), a.end()); int sum_x = 0; while ((sum_x + a[counter]) <= x && counter < n) { sum_x += a[counter]; answer += 1; counter += 1; } bool possible = true; while (possible) { if (sum_x - a[counter-1] + a[counter] <= x) { sum_x = sum_x - a[counter-1] + a[counter]; uebersprungene.push_back(a[counter-1]); counter += 1; } else possible = false; } int sum_y = 0; for (auto j : uebersprungene) { if (sum_y + j <= y) { sum_y += j; answer += 1; } } while ((sum_y + a[counter]) <= y && counter < n) { sum_y += a[counter]; answer += 1; counter += 1; } return answer; }
#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...