# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
202374 | mohamedsobhi777 | 로봇 (IOI13_robots) | C++14 | 0 ms | 0 KiB |
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;
const int N = 10000 + 4;;
int n ;
int putaway(int A , int B , int T , vector<int> x , vector<int> y , vector<int> w , vector<int> s)
{
int ret = 0;
sort(x.begin() , x.end());
sort(w.begin(), w.end());
int l = 1 , r = T;
if(w[T-1] >= x[A-1])
return -1;
int ans = T;
while(l<=r)
{
int mid =(l+r)/2;
bool ok = 1;
int j = 0 , k = 0;
for(int i =0;i<T;i++)
{
while(w[i] >= x[j] && j<A)
{
j++;
}
if(j==A)
{
ok = 0;
break;
}
k++;
if(k==mid)
{
j++;
k=0;
}
}
if(ok)
{
ans = ok;
r = mid-1;
}
else
{
l = mid+1;
}
}
return ans;
}