Submission #1077914

#TimeUsernameProblemLanguageResultExecution timeMemory
1077914juicyRobots (IOI13_robots)C++17
0 / 100
3098 ms604 KiB
#include "robots.h" #include <bits/stdc++.h> int putaway(int a, int b, int t, int *x, int *y, int *w, int *s) { std::sort(x, x + a); std::sort(y, y + b); std::vector<int> ord(t); iota(ord.begin(), ord.end(), 0); std::sort(ord.begin(), ord.end(), [&](int i, int j) { return std::tie(w[i], s[i]) < std::tie(w[j], s[j]); }); auto check = [&](int k) { std::priority_queue<int> pq; int j = 0; for (int i = 0; i < a; ++i) { while (j < t && w[ord[j]] < x[i]) { pq.push(s[ord[j++]]); } int could = k; while (pq.size() && could) { pq.pop(); --could; } } while (j < t) { pq.push(s[ord[j++]]); } for (int i = b - 1; i; --i) { int could = k; while (pq.size() && pq.top() < y[i] && could) { pq.pop(); --could; } } return !pq.size(); }; int l = 0, r = t, res = -1; while (l <= r) { int m = (l + r) / 2; if (check(m)) { res = m; r = m - 1; } else { l = m + 1; } } return res; }
#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...