Submission #305322

#TimeUsernameProblemLanguageResultExecution timeMemory
305322TemmieRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> struct Toy { int w, s; Toy(int W = 0, int S = 0) : w(W), s(S) { } bool operator<(const Toy& other) const { if (w == other.w) return s < other.s; return w < other.w; } }; int putaway(int a, int b, int t, std::vector <int> x, std::vector <int> y, std::vector <int> w, std::vector <int> s) { std::vector <Toy> toy(t); for (int i = 0; i < t; i++) toy[i] = Toy(w[i], s[i]); std::sort(toy.begin(), toy.end()); std::sort(x.begin(), x.end()); std::sort(y.rbegin(), y.rend()); int l = 0, r = t + 1; while (l < r) { int mid = l + ((r - l) >> 1), toys = 0; std::priority_queue <int> pq; for (int i = 0; i < a; i++) { while (toys < t && toy[pq.size()].w < x[i]) pq.push(toy[pq.size()].s), toys++; int tmp = mid; while (pq.size() && tmp--) pq.pop(); } while (toys < t) pq.push(toy[pq.size()].s), toys++; bool brk = false; for (int i = 0; i < b; i++) { int tmp = mid; while (pq.size() && tmp--) { if (pq.top() >= y[i]) { l = mid + 1; brk = true; break; } pq.pop(); } if (brk) break; } if (brk) continue; if (pq.empty()) r = mid; else l = mid + 1; } if (l == t + 1) return -1; return l; }

Compilation message (stderr)

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