제출 #248170

#제출 시각아이디문제언어결과실행 시간메모리
248170Nightlight로봇 (IOI13_robots)C++14
100 / 100
1878 ms24396 KiB
#include "robots.h" #include <bits/stdc++.h> #define pii pair<int, int> using namespace std; int ans = -1; pii toy[1000005]; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { for(int i = 0; i < T; i++) { toy[i] = {W[i], S[i]}; } sort(toy, toy + T); sort(X, X + A); sort(Y, Y + B); int l = 1, r = T, mid; int p = 0; toy[T] = {INT_MAX, 0}; while(l <= r) { priority_queue<int, vector<int>> pq; mid = (l + r) >> 1; p = 0; for(int i = 0; i < A; i++) { while(toy[p].first < X[i]) pq.emplace(toy[p++].second); for(int k = 0; k < mid && !pq.empty(); k++) pq.pop(); } while(p < T) pq.emplace(toy[p++].second); for(int i = B - 1; i >= 0; i--) { for(int k = 0; k < mid && !pq.empty(); k++) { if(pq.top() >= Y[i]) goto STOP; pq.pop(); } } STOP: if(pq.empty()) { ans = mid; r = mid - 1; }else { l = mid + 1; } } return ans; }
#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...