Submission #963880

#TimeUsernameProblemLanguageResultExecution timeMemory
963880irmuunRobots (IOI13_robots)C++17
0 / 100
3052 ms4444 KiB
#include<bits/stdc++.h> #include "robots.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int putaway(int A,int B,int T,int X[],int Y[],int W[],int S[]){ pair<int,int>toy[T]; for(int i=0;i<T;i++){ toy[i].ff=W[i]; toy[i].ss=S[i]; } sort(toy,toy+T); sort(X,X+A); sort(Y,Y+B); int l=1,r=T+1; vector<bool>used(T); while(l<r){ int mid=(l+r)/2; fill(all(used),0); set<pair<int,int>,greater<pair<int,int>>>st; int le=0,cur; for(int i=0;i<A;i++){ while(le<T&&toy[le].ff<X[i]){ st.insert({toy[le].ss,le}); } cur=mid; while(cur--&&!st.empty()){ used[st.begin()->ss]=true; st.erase(st.begin()); } } st.clear(); for(int i=0;i<T;i++){ if(!used[i]){ st.insert({toy[i].ss,i}); } } for(int i=B-1;i>=0;i--){ int cur=mid; while(cur--&&!st.empty()){ if(st.begin()->ff<Y[i]){ st.erase(st.begin()); } else break; } } if(st.empty()) l=mid+1; else r=mid; } if(l==T+1) return -1; return l; }
#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...