#include "jelly.h"
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
#include <map>
#include <iomanip>
#include <stack>
#include <fstream>
using namespace std;
int find_maximum_unique(int x, int y, std::vector<int> a, std::vector<int> b) {
int n = a.size();
vector<pair<int,int> >pa(n);
vector<pair<int,int> >pb(n);
for(int i=0;i<n;i++){
pa[i]=make_pair(a[i],i);
pb[i]=make_pair(b[i],i);
}
sort(pb.begin(),pb.end());
sort(pa.begin(),pa.end());
int r=0;
vector<bool>v(n,false);
bool f=true,s=true;
for(int i=0;i<n;i++){
if(f){
if(!v[pb[i].second]){
if(pb[i].first<=y){
r++;
y-=pb[i].first;
}
else{
f=false;
}
}
}
if(s){
if(!v[pa[i].second]){
if(pa[i].first<=y){
r++;
y-=pa[i].first;
}
else{
s=false;
}
}
}
if(!f && !s)break;
}
return r;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
1st lines differ - on the 1st token, expected: '689', found: '642' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
1st lines differ - on the 1st token, expected: '62', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
1st lines differ - on the 1st token, expected: '154', found: '70' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
1st lines differ - on the 1st token, expected: '8', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |