제출 #578823

#제출 시각아이디문제언어결과실행 시간메모리
578823Belgutei로봇 (IOI13_robots)C++17
0 / 100
1 ms340 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define pb push_back #define mk make_pair #define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const int N = 1000005; int l,r; pair<int,int> p[N]; priority_queue<int> pq; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { l = 1; r = T; // for(int i = 0; i < T; i ++) { p[i].ff = W[i]; p[i].ss = S[i]; } sort(X, X + A); sort(Y, Y + B); sort(p, p + T); // bool ok = 0; while(l < r) { int mid = (l + r) / 2; int pos = 0; for(int i = 0; i < A; i ++) { while(pos < T && p[pos].ff < X[i]) { pq.push(p[pos].ss); pos ++; } int tmp = mid; while(tmp -- && pq.size() > 0) { pq.pop(); } } while(pos < T) { pq.push(p[pos].ss); pos ++; } for(int i = B - 1; i >= 0; i --) { int tmp = mid; while(tmp -- && pq.size() > 0 && pq.top() < Y[i]) { pq.pop(); } } if(pq.size() == 0) { r = mid; ok = 1; } else l = mid + 1; while(pq.size() > 0) { pq.pop(); } } if(ok == 0) 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...