제출 #15632

#제출 시각아이디문제언어결과실행 시간메모리
15632progressive로봇 (IOI13_robots)C++14
100 / 100
2146 ms17500 KiB
#include "robots.h" #include<algorithm> #include<queue> #include<cstdio> using namespace std; static int A,B,T; static int *X,*Y; static pair<int,int> toy[1010101]; static bool can(int a) { int ptoy=0; priority_queue<int> PQ; for(int i=0;i<A;i++) { while(ptoy<T && toy[ptoy].first<X[i]) PQ.push(toy[ptoy++].second); for(int j=0;j<a && !PQ.empty() ;j++) PQ.pop(); } for(int i=ptoy;i<T;i++) PQ.push(toy[i].second); for(int i=B-1;i>=0;i--) { if(PQ.empty()) return true; if(PQ.top()>=Y[i]) return false; for(int j=0;j<a && !PQ.empty();j++) PQ.pop(); } return PQ.empty(); } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { ::A=A,::B=B,::T=T; ::X=X,::Y=Y; sort(X,X+A); sort(Y,Y+B); for(int i=0;i<T;i++) { if(W[i]>=X[A-1] && S[i]>=Y[B-1]) return -1; toy[i]=make_pair(W[i],S[i]); } sort(toy,toy+T); int lo=0; int hi=T+1; while(lo+1!=hi) { int mi=(lo+hi+1)/2; if(can(mi)) hi=mi; else lo=mi; } return hi; }
#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...