Submission #377285

#TimeUsernameProblemLanguageResultExecution timeMemory
377285gustasonRobots (IOI13_robots)C++14
0 / 100
2761 ms23136 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { sort(X, X+A); sort(Y, Y+B); vector<pair<int, int>> a(T); for(int i = 0; i < T; i++) { a[i] = {W[i], S[i]}; } sort(a.begin(), a.end()); int l = 0, r = INF, ans = 0; while(l <= r) { int mid = (l + r) / 2; priority_queue<int> q; int idx = 0; for(int i = 0; i < A; i++) { while(idx < T && X[i] > a[idx].first) { q.push(a[idx].second); idx++; } for(int j = 0; j < mid && !q.empty(); j++) { q.pop(); } } while(idx < T) { q.push(a[idx].second); idx++; } for(int i = B-1; i >= 0; i--) { for(int j = 0; j < mid && !q.empty(); j++) { if (q.top() < Y[i]) { q.pop(); } else { break; } } } if (q.empty()) { ans = mid; r = mid - 1; } else { l = mid + 1; } } if (ans == INF) return -1; return ans; }
#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...