제출 #377286

#제출 시각아이디문제언어결과실행 시간메모리
377286gustason로봇 (IOI13_robots)C++14
100 / 100
2686 ms24676 KiB
#include "robots.h" #include<bits/stdc++.h> using namespace std; const int INF = 1e9 + 5; 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<pair<int, int>> a(T); for(int i = 0; i < T; i++) { a[i] = {W[i], S[i]}; } sort(a.begin(), a.end()); int l = 0, r = INF, ans = INF; while(l <= r) { int mid = (l + r) / 2; priority_queue<int> q; int idx = 0; for(int i = 0; i < A; i++) { while(idx < T && X[i] > a[idx].first) { q.push(a[idx].second); idx++; } for(int j = 0; j < mid && !q.empty(); j++) { q.pop(); } } while(idx < T) { q.push(a[idx].second); idx++; } for(int i = B-1; i >= 0; i--) { for(int j = 0; j < mid && !q.empty(); j++) { if (q.top() < Y[i]) { q.pop(); } else { break; } } } if (q.empty()) { ans = mid; r = mid - 1; } else { l = mid + 1; } } if (ans == INF) return -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...