제출 #59150

#제출 시각아이디문제언어결과실행 시간메모리
59150aome로봇 (IOI13_robots)C++17
0 / 100
3 ms700 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; const int N = 1000005; const int M = 50005; int P[N]; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { for (int i = 0; i < T; ++i) P[i] = i; sort(X, X + A); sort(Y, Y + B); sort(P, P + T, [&] (int x, int y) { return W[x] < W[y]; }); int l = 1, r = T; bool haveSolution = 0; while (l < r) { int mid = (l + r) >> 1; int ptr = 0; priority_queue<int> pq; for (int i = 0; i < A; ++i) { while (ptr < T && W[P[ptr]] < X[i]) pq.push(S[P[ptr++]]); int cur = mid; while (cur && pq.size()) pq.pop(), cur--; } while (ptr < T) pq.push(S[P[ptr++]]); bool fail = 0; for (int i = B - 1; i >= 0; --i) { int cur = mid; while (cur && pq.size()) { if (pq.top() >= Y[i]) { fail = 1; break; } pq.pop(), cur--; } if (fail) break; } if (fail) l = mid + 1; else { haveSolution = 1, r = mid; } } if (!haveSolution) return -1; return l; }
#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...