Submission #111081

#TimeUsernameProblemLanguageResultExecution timeMemory
111081The_WolfpackRobots (IOI13_robots)C++14
0 / 100
6 ms768 KiB
#include "robots.h" #include <bits/stdc++.h> #define pii pair<int,int> #define x first #define y second using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { vector<pii> v; for(int i=0;i<T;i++) v.push_back({W[i],S[i]}); sort(X,X+A); sort(Y,Y+B); sort(v.begin(),v.end()); auto ok=[&](int mid) { priority_queue<pii> PQ; vector<int> resen(T); int j=0; for(int i=0;i<A;i++) { int vreme=0; while(j<T && X[i]>v[j].x) { j++; PQ.push({v[j].y,j}); } while(!PQ.empty() && vreme<mid) { ++vreme; resen[PQ.top().y]=1; PQ.pop(); } } while(j<T) { j++; PQ.push({v[j].y,j}); } for(int i=B-1;i>=0;i--) { int vreme=0; while(!PQ.empty() && vreme<mid && PQ.top().x<Y[i]) { vreme++; resen[PQ.top().y]=1; PQ.pop(); } }; for(int i=0;i<T;i++) if(!resen[i]) return 0; return 1; }; int l=0; int r=T; int odg=-1; while(l<=r) { int mid=(l+r)/2; if(ok(mid)) { odg=mid; l=mid+1; } else r=mid-1; } return odg; }
#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...