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>
#define fori(a,b,c) for(int a=b; a<c; a++)
#define ford(a,b,c) for(int a=b; a>=c; a--)
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
bool a[2][2];
int b[2];
int tt[1000004];
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
if(B==0){
sort(W,W+T);
sort(X,X+A);
int l=A;
int ans=1;
ford(i,T-1,0){
if(i!=T-1)
tt[i]=tt[i+1];
ford(j,l-1,0){
if(X[j]>W[i]){
tt[i]++;
}
else{
l=j+1;
break;
}
}
if(tt[i]*ans<(T-i)){
if(i==T-1)
return -1;
ans++;
}
//cout << tt[i] << " " << i << " " << ans << endl;
}
return ans;
}
fori(i,0,2){
int k=0;
fori(j,0,A){
if(W[i]<X[j]){
a[j][i]=1;
b[i]++;
}
k++;
}
fori(j,0,B){
if(S[i]<Y[k]){
a[k][i]=1;
b[i]++;
}
k++;
}
}
if(!b[0] || !b[1]){
return -1;
}
if(b[0]==1 && b[1]==1){
if((a[0][0]==0 && a[0][1]==0) || (a[1][0]==0 && a[1][1]==0) )
return 2;
}
return 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... |