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;
vector<int>s[1000];
bool vis[100000];
int putaway(int A, int B, int T, int X[], int Y[], int W[], int H[]) {
sort(X,X+A);
sort(Y,Y+B);
for(int i=0;i<T;i++){
if(W[i]>=X[A-1] && H[i]>=Y[B-1]) return -1;
}
for(int i=0;i<A;i++){
for(int j=0;j<T;j++){
if(W[j]<X[i]) s[i].push_back(j);
}
}
for(int i=0;i<B;i++){
for(int j=0;j<T;j++){
if(H[j]<Y[i]) s[i+A].push_back(j);
}
}
int k=0,ans=0;
while(k<T){
for(int i=0;i<=(A+B-1);i++){
while(s[i].size()>0 && vis[s[i].back()]==1) s[i].pop_back();
if(s[i].size()){
vis[s[i].back()]=1;
s[i].pop_back();
k++;
}
}
ans++;
}
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... |