#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |