Submission #372952

#TimeUsernameProblemLanguageResultExecution timeMemory
372952JoshcRobots (IOI13_robots)C++11
Compilation error
0 ms0 KiB
#include <cstdio> #include <algorithm> #include <vector> #include <queue> using namespace std; int putaway(int a, int b, int t, int X[], int Y[], int W[], int S[]) { vector<int> x, y; 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(x.begin(), x.end()); sort(y.begin(), y.end()); vector<pair<int, int> > v; for (int i=0; i<t; i++) { v.emplace_back(W[i], S[i]); if ((x.empty() || W[i]>=x.back()) && (y.empty() || S[i]>=y.back())) return -1; } sort(v.begin(), v.end()); reverse(y.begin(), y.end()); int low=1, high=t, mid; while (low != high) { mid = (low+high) >> 1; priority_queue<int> pq; int cur = 0; for (int i : x) { while (cur<t && v[cur].first<i) pq.push(v[cur++].second); int z = min((int)pq.size(), mid); for (int i=0; i<z; i++) pq.pop(); } for (; cur<t; cur++) pq.push(v[cur].second); for (int i : y) { int z = 0; while (z++<mid && !pq.empty() && pq.top()<i) pq.pop(); } if (pq.empty()) high = mid; else low = mid+1; } return low; }

Compilation message (stderr)

/tmp/ccJgghuX.o: In function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status