Submission #1314796

#TimeUsernameProblemLanguageResultExecution timeMemory
1314796orgiloogiiRobots (IOI13_robots)C++20
0 / 100
0 ms332 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define ff first #define ss second int putaway(int n, int m, int t, int x[], int y[], int w[], int s[]) { vector <pair <int, int>> v; for (int i = 0;i < t;i++) { v.push_back({w[i], s[i]}); } sort(v.begin(), v.end()); int l = 0, r = t; while (l + 1 < r) { int tm = (l + r) / 2; priority_queue <int> pq; int k = 0; int i; for (int id = 0;id < n;id++) { for (i = k;i < t;i++) { if (x[id] <= v[i].ff) { break; } pq.push(v[i].ss); } k = i; int rem = 0; while (!pq.empty()) { if (rem == tm) break; rem++; pq.pop(); } } while (i < t) { pq.push(v[i].ss); i++; } int j = 0; int cnt = 0; while (!pq.empty()) { if (cnt == tm || y[j] <= pq.top()) { j++; cnt = 0; } if (j >= m) break; cnt++; pq.pop(); } if (pq.empty()) { r = tm; } else { l = tm; } } return r; } /* int main() { int n, m, t; cin >> n >> m >> t; int x[n], y[m]; for (int i = 0;i < n;i++) { cin >> x[i]; } for (int i = 0;i < m;i++) { cin >> y[i]; } int w[t], s[t]; for (int i = 0;i < t;i++) { cin >> w[i] >> s[i]; } cout << putaway(n, m, t, x, y, w, s); } */ /* 3 2 10 6 2 9 4 7 4 6 8 5 2 3 7 9 1 8 5 1 3 3 8 7 7 6 10 5 */
#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...