# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
993175 | MrDeboo | Robots (IOI13_robots) | C++17 | 1 ms | 4444 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>>v;
void slv(deque<int>dq){
map<pair<int,int>,int>mp;
priority_queue<pair<int,int>>pq;
int l=0;
for(int i=0;i<dq.size();i++){
while(l<v.size()&&dq[i]>v[l].first){
pq.push({v[l].second,v[l].first});
l++;
}
if(pq.size()){
mp[{pq.top().second,pq.top().first}]++;
pq.pop();
}
}
vector<pair<int,int>>vec;
for(auto &i:v){
if(mp[i]){
mp[i]--;
}else vec.push_back(i);
}
}
int putaway(int A, int B, int t, int x[], int y[], int w[], int s[]) {
for(int i=0;i<t;i++)v.push_back({w[i],s[i]});
deque<int>a,b;
for(int i=0;i<A;i++)a.push_back(x[i]);
for(int i=0;i<B;i++)b.push_back(y[i]);
int sz=t+1,cnt=0;
while(v.size()&&sz!=v.size()){
cnt++;
sz=v.size();
sort(v.begin(),v.end());
slv(a);
for(auto &i:v)swap(i.first,i.second);
sort(v.begin(),v.end());
slv(b);
for(auto &i:v)swap(i.first,i.second);
}
if(v.size())cnt=-1;
return cnt;
}
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... |