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"
using namespace std;
#define ll long long
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]){
vector<int> w,s;
for(int i=0;i<A;i++)w.push_back(X[i]);
for(int i=0;i<B;i++)s.push_back(Y[i]);
sort(w.begin(),w.end());
sort(s.begin(),s.end());
if(B!=0){
if(B==1){
if((S[0]<s[0] && W[1]<w[0])|| (S[1]<s[0] && W[0]<w[0]))return 1;
if((S[0]<s[0] && S[1]<s[0])|| (W[1]<w[0] && W[0]<w[0]))return 2;
return -1;
}
if((S[0]<s[0] && S[1]<s[1])|| (S[0]<s[1] && S[1]<s[0]))return 1;
if((S[0]<s[1] && S[1]<s[1]))return 2;
return -1;
}
vector<int> p(60000,0);
for(int i=0;i<T;i++){
if(W[i]<w.back()){
int pos=lower_bound(w.begin(),w.end(),W[i]+1)-w.begin();
p[pos]++;
}else{
return -1;
}
}
int ans=0;
int tot=0;
for(int i=A-1;i>=0;i--){
tot+=p[i];
ans=max(ans,(tot+A-i-1)/(A-i));
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |