Submission #769259

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7692592023-06-29 11:05:12keta_tsimakuridzeRobots (IOI13_robots)C++14
76 / 100
3043 ms35628 KiB
#include "robots.h"
#include<bits/stdc++.h>
#define f first
#define s second
using namespace std;
int putaway(int A, int B, int N, int X[], int Y[], int W[], int S[]) {
vector<pair<int,int>> p(N);
for(int i = 0; i < N; i++) {
p[i] = {W[i], S[i]};
}
sort(p.begin(), p.end());
// for(int i = 0; i < N; i++) cout << p[i].f << " " << p[i].s << "\n";
sort(X, X + A); sort(Y, Y + B);
int l = 1, r = N, ans = N + 1;
while(l <= r) {
int mid = (l + r) / 2;
multiset<int> s;
{
int L = -1;
for(int i = 0; i < A; i++) {
while(L + 1 < N && p[L + 1].f < X[i]) ++L, s.insert(p[L].s);
for(int j = 1; j <= mid; j++) {
if(!s.size()) break;
s.erase(s.find(*--s.end()));
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...