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;
#define ll long long
#define pb push_back
const int N=1000100;
const int R=100000;
int a,b,t;
vector<int>x;
vector<int>y;
vector<int>w;
vector<int>s;
vector<pair<int,int>> WS;
int binary(int mn, int md, int mx){
//priority_queue<pair<int,int>>pq;
while(mx!=md){
//cout<<mn<<" "<<md<<" "<<mx<<endl;
int pos=0;
int cont=md;
bool posible=true;
for(int i=0;i<t;i++){
cout<<w[i]<<" "<<x[pos]<<" WI XPOS"<<endl;
if(w[i]>=x[pos]){
posible=false;
break;
}
cont--;
if(cont==0){
cont=md;
pos++;
}
}
if(posible==true){
mx=md;
md=(mn+mx)/2;
}else{
mn=md;
md=(mn+mx+1)/2;
}
}
return mx;
}
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
a=A;
b=B;
t=T;
for(int i=0;i<t;i++){
w.pb(W[i]);
s.pb(S[i]);
WS.pb({w[i],s[i]});
}
for(int i=0;i<a;i++){
x.pb(X[i]);
}
for(int i=0;i<b;i++){
y.pb(Y[i]);
}
sort(w.rbegin(),w.rend());
sort(x.rbegin(),x.rend());
int answer=binary(1,(t+3)/2,t+2);
if(answer>t) return -1;
return answer;
}
# | 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... |