제출 #1190107

#제출 시각아이디문제언어결과실행 시간메모리
1190107raspy로봇 (IOI13_robots)C++20
0 / 100
0 ms328 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; // w -> teze igrac, s - > velikosti igrac // x -> omejitve dviga teze, y -> omejitve dviga velikosti int putaway(int a, int b, int n, int X[], int Y[], int W[], int S[]) { vector<int> w, s, x, y; for (int i = 0; i < n; i++) { w.push_back(W[i]); s.push_back(S[i]); } for (int i = 0; i < a; i++) x.push_back(X[i]); for (int i = 0; i < b; i++) y.push_back(Y[i]); sort(y.begin(), y.end()); sort(x.begin(), x.end()); vector<pair<int, int>> igrace; for (int i = 0; i < n; i++) igrace.push_back(make_pair(w[i], s[i])); sort(igrace.begin(), igrace.end()); auto mozno = [&igrace, &x, &y](int tr) -> bool { int j = 0; multiset<int> st; for (int v : x) { while (j < igrace.size() && igrace[j].first <= v) { st.insert(igrace[j].second); j++; } for (int i = 0; i < tr && st.size(); i++) st.erase(st.find(*st.rbegin())); } if (j < (int)igrace.size()) return false; for (int v : y) { for (int i = 0; i < tr && st.size(); i++) if (*st.begin() <= v) st.erase(st.begin()); } return st.empty(); }; if (!mozno(n+1)) return -1; int l = 0, d = n+1; while (l+1 < d) { int mid = (l+d)/2; if (mozno(mid)) l = mid; else d=mid; } 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...