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 "king.h"
#include <algorithm>
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
std::sort(W.begin(),W.end());
std::sort(C.begin(),C.end());
int min = 0, max = N;
int ans = 0;
while(min<=max)
{
int h = (min+max)/2;
for(int i=0;i<h;i++) if(W[i]>C[N+i-h]) goto u;
ans = h;
min = h+1;
continue;
u:;
max = h-1;
}
if(ans==0) return 0;
else return W[ans-1];
}
#include "vassal.h"
#include <algorithm>
#include <map>
std::multimap<long long int,int> M;
long long limit;
int check[100010];
bool cmp(std::pair<int,int> A, std::pair<int,int> B)
{
return A.first<B.first;
}
void Init(long long B, std::vector<int> C){
int N = C.size();
limit = B;
for(int i=0;i<N;i++) M.insert(std::make_pair(C[i],i));
}
int Maid(int W){
if(W>limit) return -1;
else
{
std::map<long long int,int> ::iterator it;
it = M.lower_bound(W);
if(it==M.end()) return -1;
else
{
int ans = it->second;
M.erase(it);
return ans;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |