Submission #439461

#TimeUsernameProblemLanguageResultExecution timeMemory
439461jlallas384Jelly Flavours (IOI20_jelly)C++17
10 / 100
10 ms388 KiB
#include <bits/stdc++.h> using namespace std; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n = a.size(); vector<int> hv(n); vector<pair<int,int>> st1,st2; for(int i = 0; i < n; i++){ st1.emplace_back(a[i],i); } for(int i = 0; i < n; i++){ st2.emplace_back(b[i],i); } sort(st1.begin(), st1.end()); sort(st2.begin(), st2.end()); int ans = 0; for(int i = 0; i <= n; i++){ int cur = y,ths = 0; for(auto [xj,j]: st2){ if(cur >= xj && !hv[j]){ ths++; cur -= xj; } } ans = max(ans,ths + i); if(i < n){ if(x >= st1[i].first){ hv[st1[i].second] = 1; x -= st1[i].first; }else break; } } return ans; }
#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...