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>
#include "robots.h"
#ifdef ALE
#include "grader.c"
#endif
using namespace std;
const int nax=1e6+5;
priority_queue<int> q;
int idx1[nax];
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
auto cmp1=[W](int a, int b){
return W[a]<W[b];
};
iota(idx1,idx1+T,0);
sort(idx1,idx1+T,cmp1);
sort(X,X+A);
sort(Y,Y+B,greater<int>());
auto check=[A,B,T,X,Y,W,S](int t){
while(!q.empty())q.pop();
int j=0;
for(int i=0;i<A;i++){
while(j<T&&W[idx1[j]]<X[i])q.push(S[idx1[j++]]);
for(int z=0;z<t&&!q.empty();z++){
q.pop();
}
}
while(j<T)q.push(S[idx1[j++]]);
for(int i=0;i<B&&!q.empty();i++){
if(q.top()>=Y[i])return false;
for(int z=0;z<t&&!q.empty();z++){
q.pop();
}
}
return q.empty();
};
int x=-1;
if(!check(T))return -1;
for(int b=T;b>=1;b/=2)
while(!check(x+b))x+=b;
return x+1;
}
# | 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... |