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"
vector<int> xs, ys, as, bs;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
as = vector<int> (A), bs = vector<int> (B), xs = vector<int> (T), ys = vector<int> (T);
for(int i = 0; i < T; i++) xs[i] = W[i]; //cout << xs[i] << " ";
for(int i = 0; i < T; i++) ys[i] = S[i];
for(int i = 0; i < A; i++) as[i] = X[i]; //cout << i << " " << as[i] << " ";
for(int i = 0; i < B; i++) bs[i] = Y[i];
sort(xs.begin(), xs.end());
sort(ys.begin(), ys.end());
sort(as.begin(), as.end());
sort(bs.begin(), bs.end());
if(xs[T-1] > as[A-1]) return -1;
int res = 0;
priority_queue<int> q;
for(int i = T - 1; i >= 0; i--){
if(q.empty()) q.push(A-1), res++;
auto t = q.top(); q.pop();
if(as[t] < xs[i]){
q.push(t);
if(A > 1) q.push(A-2);
res++;
}
if(t > 0) q.push(t-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... |