# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
171093 | dennisstar | Robots (IOI13_robots) | C++11 | 2043 ms | 12636 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>
#define fi first
#define se second
#define ryan bear
#define all(V) ((V).begin()), ((V).end())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef vector<int> vim;
typedef vector<ll> vlm;
vector<pii> ar;
priority_queue<int, vector<int>, less<int> > pq;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
sort(X, X+A); sort(Y, Y+B);
for (int i=0; i<T; i++) ar.push_back({W[i], S[i]});
sort(all(ar));
for (int i=0; i<T; i++) if (X[A-1]<=W[i]&&Y[B-1]<=S[i]) return -1;
int s=0, e=T;
int x;
while (s+1<e) {
ll md=(s+e+1)/2;
int i, j, k;
for (i=0, j=0; i<A; i++) {
for (; X[i]>ar[j].fi&&j<T; j++) pq.push(ar[j].se);
for (k=0; !pq.empty()&&k<md; k++) pq.pop();
}
for (; j<T; j++) pq.push(ar[j].se);
for (i=B-1; i>=0; i--) {
for (j=0; !pq.empty()&&j<md&&pq.top()<Y[i]; j++) pq.pop();
}
if (!pq.empty()) s=md;
else e=md;
while(!pq.empty()) pq.pop();
}
return e;
}
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... |