제출 #94351

#제출 시각아이디문제언어결과실행 시간메모리
94351fjzzq2002로봇 (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=upper_bound(x.begin(), x.end(),W[i])-x.begin(), q=upper_bound(y.begin(), y.end(),S[i])-y.begin(); if(p>=A&&q>=B) return -1; a.insert(pii(p,q)); b.insert(pii(q,p)); } int cn=0; while(a.size()) { ++cn; for(int i=0;i<A;++i) { auto g=a.lower_bound(pii(i,-233)); if(g==a.end()||g->fi>=A) break; pii x=*g; a.erase(g); b.erase(b.find(pii(x.se,x.fi))); } for(int i=0;i<B;++i) { auto g=b.lower_bound(pii(i,-233)); if(g==b.end()||g->fi>=B) 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...