제출 #996525

#제출 시각아이디문제언어결과실행 시간메모리
996525aykhn로봇 (IOI13_robots)C++17
0 / 100
3017 ms40408 KiB
#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[]) { sort(X, X + A), sort(Y, Y + B); vector<int> o(T, 0); iota(o.begin(), o.end(), 0); sort(o.begin(), o.end(), [&](const int &a, const int &b) { return W[a] < W[b]; }); int l = 1, r = T; while (l < r) { int mid = (l + r) >> 1; int j = 0; multiset<int> ms; for (int i = 0; i < A; i++) { while (j < T && W[o[j]] < X[i]) ms.insert(S[o[j]]), j++; int c = mid; while (c-- && !ms.empty()) ms.erase(prev(ms.end())); } while (j < T) ms.insert(S[o[j]]), j++; for (int i = 0; i < B; i++) { int c = mid; while (c-- && !ms.empty() && *ms.begin() < Y[i]) ms.erase(ms.begin()); } if (ms.empty()) r = mid; else l = mid + 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...