제출 #676363

#제출 시각아이디문제언어결과실행 시간메모리
676363groshi로봇 (IOI13_robots)C++17
0 / 100
1 ms312 KiB
#include<iostream> #include<algorithm> #include<queue> #include"robots.h" using namespace std; int putaway(int A,int B,int T,int x[],int y[],int W[],int S[]) { vector<pair<int,int> > zabawki; for(int i=0;i<T;i++) zabawki.push_back({W[i],S[i]}); sort(zabawki.begin(),zabawki.end()); vector<int> X,Y; for(int i=0;i<A;i++) X.push_back(x[i]); for(int i=0;i<B;i++) Y.push_back(y[i]); sort(X.begin(),X.end()); sort(Y.begin(),Y.end()); int pocz=0,kon=T,sre,ostd=-1; while(pocz<kon) { sre=(pocz+kon)/2; int gdzie=0; priority_queue<int> kolejka; for(int i=0;i<A;i++) { while(gdzie<T && zabawki[gdzie].first<X[i]) kolejka.push(zabawki[gdzie].second),gdzie++; for(int j=0;j<sre;j++) if(!kolejka.empty()) kolejka.pop(); else break; } while(gdzie<T) kolejka.push(zabawki[gdzie].second),gdzie++; for(int i=B-1;i>=0;i--) { if(kolejka.empty()) break; if(Y[i]<=kolejka.top()) break; for(int j=0;j<sre;j++) if(!kolejka.empty()) kolejka.pop(); else break; } if(kolejka.empty()) { ostd=sre; kon=sre; } else pocz=sre+1; } return ostd; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...