Submission #94352

#TimeUsernameProblemLanguageResultExecution timeMemory
94352fjzzq2002Robots (IOI13_robots)C++14
0 / 100
2 ms380 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second typedef pair<int,int> pii; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { vector<int> x,y; for(int i=0;i<A;++i) x.pb(X[i]); for(int i=0;i<B;++i) y.pb(Y[i]); multiset<pii> a,b; for(int i=0;i<T;++i) { int p=x.end()-upper_bound(x.begin(), x.end(),W[i]), q=y.end()-upper_bound(y.begin(), y.end(),S[i]); if(p==0&&q==0) return -1; a.insert(pii(p,q)); b.insert(pii(q,p)); } int cn=0; while(a.size()) { ++cn; for(int i=1;i<=A;++i) { auto g=a.lower_bound(pii(i,-233)); if(g==a.end()) break; pii x=*g; a.erase(g); b.erase(b.find(pii(x.se,x.fi))); } for(int i=1;i<=B;++i) { auto g=b.lower_bound(pii(i,-233)); if(g==b.end()) break; pii x=*g; b.erase(g); a.erase(a.find(pii(x.se,x.fi))); } } return cn; }
#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...