This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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[i].second])continue;
if(x-an[i].first>-1){
cont++;
x-=an[i].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[i].second])continue;
if(y-bn[i].first>-1){
cont++;
y-=bn[i].first;
}
else break;
}
return cont;
}
return n;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |