# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1160917 | SmuggingSpun | Robots (IOI13_robots) | C++20 | 1425 ms | 16852 KiB |
#include "robots.h"
#include<bits/stdc++.h>
using namespace std;
const int lim = 1e6 + 5;
bitset<lim>vis;
int putaway(int A, int B, int n, int X[], int Y[], int W[], int S[]){
sort(X, X + A);
sort(Y, Y + B);
vector<int>pw(n), ps(n);
for(int i = 0; i < n; i++){
pw[i] = ps[i] = i;
}
sort(pw.begin(), pw.end(), [&] (int i, int j){
return W[i] < W[j];
});
sort(ps.begin(), ps.end(), [&] (int i, int j){
return S[i] < S[j];
});
int low = 1, high = n, ans = -1;
while(low <= high){
int mid = (low + high) >> 1;
vis.reset();
priority_queue<pair<int, int>>pq;
for(int i = 0, j = 0; i < A; i++){
while(j < n && W[pw[j]] < X[i]){
pq.emplace(S[pw[j]], pw[j]);
j++;
}
for(int _ = 0; _ < mid && !pq.empty(); _++, pq.pop()){
vis.set(pq.top().second);
# | 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... |