제출 #467442

#제출 시각아이디문제언어결과실행 시간메모리
467442SirCovidThe19th로봇 (IOI13_robots)C++17
0 / 100
1 ms332 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]){ pair<int, int> toys[T]; for (int i = 0; i < T; i++) toys[i] = {W[i], S[i]}; sort(toys, toys + T); auto check = [&](int mid){ priority_queue<int> pq; int pt = 0; for (int i = 0; i < A; i++){ for (; pt < T and toys[pt].first < X[i]; pt++) pq.push(toys[pt].second); for (int j = 0; j < mid and !pq.empty(); j++) pq.pop(); } for (; pt < T; pt++) pq.push(toys[pt].second); for (int i = B - 1; i >= 0; i--){ for (int j = 0; j < mid and !pq.empty() and pq.top() < Y[i]; j++) pq.pop(); } return pq.empty(); }; int low = 1, high = T + 1; while (low < high){ int mid = (low + high) / 2; check(mid) ? high = mid : low = mid + 1; } return (high == T + 1) ? -1 : high; }
#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...