# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1088693 | VMaksimoski008 | Robots (IOI13_robots) | C++17 | 3070 ms | 23480 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
vector<array<int, 2> > v;
for(int i=0; i<T; i++) v.push_back({ W[i], S[i] });
sort(X, X + A);
sort(Y, Y + B);
sort(v.begin(), v.end());
int l=1, r=T, ans=-1;
while(l <= r) {
int mid = (l + r) / 2;
bool ok = 1;
priority_queue<int> pq;
int j = 0;
for(int i=0; i<A; i++) {
while(j < T && v[j][0] < X[i]) pq.push(v[j][1]), j++;
for(int k=0; k<mid&&!pq.empty(); k++) pq.pop();
}
vector<int> vec;
for(int i=j; i<T; i++) pq.push(v[i][1]);
for(int i=B-1; i>=0; i--)
for(int k=0; k<mid&&!pq.empty(); k++)
if(pq.top() < Y[i]) pq.pop();
if(pq.empty()) ans = mid, r = mid - 1;
else l = mid + 1;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |