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 "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
vector <pair <int,int> > toy;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
sort(X, X+A);
sort(Y, Y+B);
toy.resize(T);
for(int i = 0 ; i < T ; i++){
toy[i].first = W[i];
toy[i].second = S[i];
}
sort(toy.begin(), toy.end() );
//reverse(toy, toy + T);
if(T==2 && A+B ==2){
if(A==2){
if(X[1] <= max(W[0], W[1]) )
return -1;
if(X[0] <= min(W[0], W[1]) )
return 2;
return 1;
}
else
if(A==1){
if( (X[0] > W[0] && Y[0] > S[1]) || (X[0] > W[1] && Y[0] > S[0]) )
return 1;
if((X[0] <= W[0] && Y[0]<= S[0] ) || (X[0] <= W[1] && Y[0]<= S[1] ) )
return -1;
return 2;
}
else{
if(Y[1] <= max(S[0], S[1]) )
return -1;
if(Y[0] <= min(S[0], S[1]) )
return 2;
return 1;
}
}
//reverse( X, X+ A);
//reverse( Y, Y+ B);
if(X[A-1] <= toy[T-1].first )
return -1;
int res = (T + A -1 )/ A;
for(int i = 0; i < A - 1 ;i++){
if( X[i] <= toy[0].first){
res = max ( res, (T + ( A - i- 1) -1 )/ (A - i -1 ));
}
int ind = upper_bound(toy.begin(), toy.end(), make_pair (X[i], 2000000002)) - toy.begin() ;
res = max ( res, (T - ind + (A-i-1) - 1) / ( A - i - 1));
}
return res;
}
# | 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... |