# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
824511 | christinelynn | Robots (IOI13_robots) | C++17 | 1366 ms | 24320 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<pair<int, int>> toy(t);
for(int i=0; i<t; i++) toy[i]={w[i], s[i]};
sort(toy.begin(), toy.end());
sort(x, x+a); sort(y, y+b);
auto can = [&](int lim) -> bool {
int idx=0;
priority_queue<int> pq;
for(int i=0; i<a; i++) {
while(idx<t && toy[idx].first<x[i]) pq.push(toy[idx++].second);
for(int j=0; j<lim && !pq.empty(); j++) pq.pop();
}
while(idx<t) pq.push(toy[idx++].second);
for(int i=b-1; i>=0; i--) {
for(int j=0; j<lim && !pq.empty(); j++) {
if(pq.top()>=y[i]) return 0;
pq.pop();
}
}
return pq.empty();
};
int l=1, r=t, ans=t+1;
while(l<=r) {
int mid=l+r>>1;
if(can(mid)) r=mid-1, ans=mid;
else l=mid+1;
}
return (ans<=t ? ans : -1);
}
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... |