Submission #639228

#TimeUsernameProblemLanguageResultExecution timeMemory
639228classicRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b, t; cin >> a >> b >> t; vector<int> x(a), y(b); for (int i = 0; i < a; i++) { cin >> x[i]; } for (int i = 0; i < b; i++) { cin >> y[i]; } vector<pair<int, int>> c(t); for (int i = 0; i < t; i++) { cin >> c[i].first >> c[i].second; } sort(x.begin(), x.end()); sort(y.begin(), y.end()); sort(c.begin(), c.end()); int low = 1, hig = t; int res = -1; while (low <= hig) { int mid = (low + hig) >> 1; priority_queue<int> pq; int idx = 0; for (int i = 0; i < a; i++) { while (idx < t && c[idx].first < x[i]) { pq.emplace(c[idx].second); idx += 1; } int cnt = 0; while (!pq.empty() && cnt < mid) { pq.pop(); cnt += 1; } } while (idx < t) { pq.emplace(c[idx].second); idx += 1; } bool ok = true; for (int i = b - 1; i >= 0; i--) { int cnt = 0; while (!pq.empty() && cnt < mid) { if (pq.top() >= y[i]) { ok = false; } pq.pop(); cnt += 1; } } ok &= pq.empty(); if (ok) { res = mid; hig = mid - 1; } else { low = mid + 1; } } cout << res; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccNlxfrp.o: in function `main':
robots.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccIko8qq.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccIko8qq.o: in function `main':
grader.c:(.text.startup+0x1b1): undefined reference to `putaway'
collect2: error: ld returned 1 exit status