# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113786 | Mercenary | Robots (IOI13_robots) | C++14 | 1728 ms | 24644 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;
typedef pair<int,int> ii;
const int maxn = 1e6 + 6;
int putaway(int n , int m , int k , int a[], int b[], int w[], int s[]) {
vector<ii> object(k);
for(int i = 0 ; i < k ; ++i)object[i] = make_pair(w[i] , s[i]);
int l = 1 , h = k;
sort(a , a + n);
sort(b , b + m);
sort(object.begin(),object.end());
while(l <= h){
int mid = l + h >> 1;
priority_queue<int> pq;
auto it = object.begin();
#define ris (*it)
for(int i = 0 ; i < n ; ++i){
while(it != object.end() && ris.first < a[i]){
pq.push(ris.second);
++it;
}
for(int t = mid ; t-- && !pq.empty() ; pq.pop());
}
while(it != object.end())pq.push(ris.second) , ++it;
for(int i = m - 1 ; i >= 0 ; --i){
for(int t = mid ; t-- && !pq.empty() && b[i] > pq.top() ; pq.pop());
}
if(pq.empty()){
h = mid - 1;
}else l = mid + 1;
}
return l > k ? -1 : l;
}
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... |