Submission #1116071

#TimeUsernameProblemLanguageResultExecution timeMemory
1116071crafticatRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define F0R(i, n) for (ll i = 0; i < n;i++) #define FOR(i,j, n) for (ll i = j; i < n;i++) template<typename T> using V = vector<T>; using vi = V<ll>; using vb = V<bool>; using pi = pair<ll, ll>; #define f first #define s second #define all(x) begin(x), end(x) constexpr ll INF = 1e11; V<pi> scan(V<pi> arr, vi xL, ll k) { sort(all(arr)); reverse(all(arr)); multiset<pi> elms; for (auto x : xL) { elms.emplace(x, k); } V<pi> results; for (auto [a,b] : arr) { auto it = elms.upper_bound({b, INF}); if (it == elms.end()) { results.emplace_back(a,b); continue; } auto [x, am] = *it; elms.erase(it); am--; if (am > 0) elms.emplace(x, am); } return results; } bool ok(vi x, vi y, V<pi> elms, ll k) { for (auto &[a,b] : elms) swap(a,b ); elms = scan(elms, x, k); for (auto &[a,b] : elms) swap(a,b ); elms = scan(elms, y, k); return elms.empty(); } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { ll l = 0, r = INF; vi x(A), y(B); V<pi> elms(T); F0R(i, A) { x[i] = X[i]; } F0R(i, B) { y[i] = Y[i]; } F0R(i, T) { elms[i] = {W[i], S[i]}; } while (r > l) { ll mid = l + (r - l) / 2; if (!ok(x, y, elms, mid)) { l = mid + 1; } else { r = mid; } } if (l >= INF) return -1; return l; }

Compilation message (stderr)

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