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 "robots.h"
#include <bits/stdc++.h>
using namespace std;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
sort(S,S+T,greater<int>());
sort(X,X+A,greater<int>());
// for(int i=0; i<T; cout<<S[i++]<<' ');cout<<endl;
// for(int i=0; i<A; cout<<X[i++]<<' ');cout<<endl;
int ans=0;
int l=1,r=1e6;
while(l<=r){
int md=(l+r)/2,ac=0;
for(int j=0,i=0,ii=0; j<A; j++){
for(; i<min(T,ii+md); i++){
if(S[i]<X[j])ac++;
}
// cout<<j<<' '<<md<<' '<<min(T,j+1*(md)+1)<<' '<<ac<<endl;
ii=i;
}
if(ac!=T)l=md+1;
else r=md-1,ans=md;
// cout<<l<<' '<<r<<endl;
}
return (ans?ans:-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... |