| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1356398 | lizi14 | Robots (IOI13_robots) | C++20 | 1 ms | 344 KiB |
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
sort(X,X+A);
sort(Y,Y+B);
int l=1,r=1e9;
vector<pair<int,int>>v(T);
for(int i=0; i<T; i++){
v[i].first=W[i];
v[i].second=S[i];
//v[i].second=i;
}
// vector<pair<int,int>>p(T);
// for(int i=0; i<T; i++){
// p[i].first=S[i];
// p[i].second=i;
// }
//sort(p.begin(),p.end());
sort(v.begin(),v.end());
int ans=-1;
while(l<=r){
int mid=(l+r)/2;
priority_queue<int>q;
int k=0;
//int modz=0;
// int la[T];
// fill(la,la+T,0);
for(int i=0; i<A; i++){
for(int j=k; j<T; j++){
if(v[j].first>=X[i]){
k=j;
break;
}
else{
k=j;
q.push(v[j].second);
}
}
for(int j=0; j<mid; j++){
if(q.size()>=1){
// pair<int,int>h=q.top();
// la[h.second]=1;
//cout<<h.first<<endl;
q.pop();
}
else break;
}
}
for(int i=k; i<T; i++){
q.push(v[i].second);
}
for(int i=B-1; i>=0; i--){
for(int j=0; j<mid; j++){
if(q.size()==0)break;
int h=q.top();
if(h>=Y[i]){
break;
}
else{
q.pop();
}
}
}
// // int y=0;
// // priority_queue<int>qa;
// for(int i=0; i<B; i++){
// for(int j=y; j<T; j++){
// //if(la[p[j].second]==0){
// if(p[j].second>=Y[i]){
// y=j;
// break;
// }
// else{
// la[p[j].second]=1;
// qa.push(p[j].first);
// }
// }
// }
// for(int j=0; j<mid; j++){
// if(qa.size()>=1){
// qa.pop();
// }
// else{
// break;
// }
// }
// }
// for(int i=0; i<T; i++){
// if(la[i]==0){
// modz=1;
// break;
// }
// }
if(q.size()==0){
ans=mid;
r=mid-1;
}
else{
l=mid+1;
}
//cout<<ans<<" "<<modz<<endl;
}
return ans;
//return 42;
}| # | 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... | ||||
