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<bits/stdc++.h>
using namespace std;
#include "robots.h"
#define rep(i,n) for(int i=0; i<n; i++)
#define ii pair<int,int>
#define f first
#define s second
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
ii r[1000010];
rep(i,T)r[i]={W[i],S[i]};
sort(r,r+T);
sort(X,X+A);
sort(Y,Y+B);
int s=0, e=T+1, m;
while(e-s>1){
m=(e+s)/2;
//cout<<m<<' ';
priority_queue<ii> pq;
int ind=0;
rep(i,A){
while(ind<T&&r[ind].f<X[i]){
pq.push({r[ind].s,r[ind].f});
ind++;
}
int M=m;
while(M--&&pq.size()){
pq.pop();
}
}
while(ind<T)pq.push({r[ind].s,r[ind].f}),ind++;
//cout<<pq.size();
for(int i=B-1; i>=0; i--){
int M=m;
if(pq.size()&&pq.top().f>=Y[i])break;
while(M--&&pq.size()){
pq.pop();
}
}
//cout<<endl;
if(pq.empty())e=m;
else s=m;
}
return ( e==T+1 ? -1 : e);
}
# | 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... |