제출 #592561

#제출 시각아이디문제언어결과실행 시간메모리
592561snasibov05로봇 (IOI13_robots)C++14
0 / 100
3083 ms25188 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[]) { int ans = -1; sort(x, x + a); sort(y, y + b); reverse(y, y + b); int l = 1, r = t; while (l <= r){ int mid = (l + r) / 2; int pt = 0; multiset<int> st; for (int i = 0; i < a; ++i){ while (pt < t && w[pt] < x[i]) st.insert(s[pt++]); for (int j = 0; j < mid; ++j){ if (st.empty()) break; st.erase(--st.end()); } } while (pt < t) st.insert(s[pt++]); int cur = 0; while (!st.empty()){ if (cur > mid) break; cur++; for (int i = 0; i < b; ++i){ auto it = st.lower_bound(y[i]); if (it == st.begin()){ if (i == 0) cur = t+1; break; } it--; st.erase(it); } } if (cur <= mid) 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...