# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1023534 | boyliguanhan | Robots (IOI13_robots) | C++17 | 1872 ms | 22992 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;
vector<pair<int,int>> stuff;
vector<int>small,weak;
int ok(int tm){
map<int,int>kriby;
for(auto y:small)
kriby[y]+=tm;
int wk=weak.size()-1;
for(auto[w,s]:stuff){
if(~wk&&w<weak[wk])
kriby[2e9+1]+=tm,wk--;
auto use=kriby.upper_bound(s);
if(use==kriby.end())return 0;
use->second--;
if(!use->second)
kriby.erase(use);
}
return 1;
}
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
for(int i=0;i<A;i++)
weak.push_back(X[i]);
for(int i=0;i<B;i++)
small.push_back(Y[i]);
for(int i=0;i<T;i++)
stuff.push_back({W[i],S[i]});
sort(stuff.rbegin(),stuff.rend());
sort(small.begin(),small.end());
sort(weak.begin(),weak.end());
int l=1,r=T,res=-1;
while(l<=r){
int mid=l+r>>1;
if(ok(mid))
res=mid,r=mid-1;
else l=mid+1;
}
return res;
}
Compilation message (stderr)
# | 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... |