Submission #406510

#TimeUsernameProblemLanguageResultExecution timeMemory
406510IwanttobreakfreeJelly Flavours (IOI20_jelly)C++17
0 / 100
2 ms460 KiB
#include "jelly.h" #include <vector> #include <algorithm> using namespace std; int find_maximum_unique(int x, int y, vector<int> a, vector<int> b) { int n=a.size(); vector<pair<int,int> >an(n); vector<pair<int,int> >bn(n); vector<bool> visto(n,false); for(int i=0;i<n;i++){ an[i]=make_pair(a[i],i); bn[i]=make_pair(b[i],i); } sort(an.begin(),bn.end()); sort(bn.begin(),bn.end()); if(y==0){ int cont=0; for(int i=0;i<n;i++){ if(bn[i].first==0){ visto[bn[i].second]=true; cont++; } else break; } for(int i=0;i<n;i++){ if(visto[an[cont].second])continue; if(x-an[cont].first>-1){ cont++; x-=an[cont].first; } else break; } return cont; } if(x==0){ int cont=0; for(int i=0;i<n;i++){ if(an[i].first==0){ visto[an[i].second]=true; cont++; } else break; } for(int i=0;i<n;i++){ if(visto[bn[cont].second])continue; if(y-bn[cont].first>-1){ cont++; y-=bn[cont].first; } else break; } return cont; } return n; }
#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...