Submission #1105141

#TimeUsernameProblemLanguageResultExecution timeMemory
1105141NaxocistRobots (IOI13_robots)C++17
0 / 100
1 ms4612 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define pb emplace_back using pi = pair<int, int>; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { // sort robots sort(X, X+A); sort(Y, Y+B, greater<int>()); vector<pi> v; for(int i=0; i<T; ++i) v.pb(W[i], S[i]); int l = 0, r = 1e6 + 1; while(l + 1 < r) { int md = l + (r-l)/2; priority_queue<int> pq; int j = 0; for(int i=0; i<A; ++i) { for(;j<T; ++j) { int w, s; tie(w, s) = v[j]; if(w >= X[i]) break ; pq.emplace(s); } int c = 1; while(pq.size() and c <= md) c ++, pq.pop(); } for(;j<T; ++j) pq.emplace(v[j].second); for(int i=0; i<B; ++i) { int c = 1; while(pq.size() and pq.top() < Y[i] and c <= md) c ++, pq.pop(); } if(!pq.empty()) l = md; else r = md; } return l == 0 ? -1 : 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...