Submission #1314801

#TimeUsernameProblemLanguageResultExecution timeMemory
1314801orgiloogiiRobots (IOI13_robots)C++20
28 / 100
1234 ms12444 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 + 1; sort(y, y + m); sort(x, x + n); while (l + 1 < r) { int tm = (l + r) / 2; priority_queue <int> pq; int k = 0; int i = 0; 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(); } //cout << tm << endl; if (pq.empty()) { r = tm; } else { /* while (!pq.empty()) { cout << pq.top() << " "; pq.pop(); } cout << endl; */ l = tm; } } if (r == t + 1) return -1; return r; }
#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...