Submission #415965

#TimeUsernameProblemLanguageResultExecution timeMemory
415965iulia13Robots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include "robots.h" #include <queue> #include <algorithm> using namespace std; const int N = 2e6 + 5; priority_queue <int> pq; struct ura{ int w, s; }; ura v[N]; bool cmp(ura a, ura b) { return a.w < b.w; } intputaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { int i; sort(X, X + A); sort(Y, Y + B); for (i = 0; i < T; i++) v[i] = {W[i], S[i]}; sort(v, v + T, cmp); int sol = -1, st = 0, dr = T, mid; while (st <= dr) { mid = (st + dr) / 2; int j = 0, bad = 0; while(!pq.empty()) pq.pop(); for (i = 0; i < A; i++) { while (v[j].w < X[i] && j < T) { pq.push(v[j].s); j++; } int cnt = 0; while (cnt < mid && !pq.empty()) { cnt++; pq.pop(); } } while (j < T) { pq.push(v[j].s); j++; } for (i = B - 1; 0 <= i && !bad && !pq.empty(); i--) { int cnt = 0; if (Y[i] <= pq.top()) { bad = 1; continue; } while (!pq.empty() && cnt < mid) { cnt++; pq.pop(); } } if (!pq.empty()) bad = 1; if (!bad) { dr = mid - 1; sol = mid; } else st = mid + 1; } return sol; }/* int X[N], Y[N], W[N], S[N]; int main() { int i, A, B, T; cin >> A >> B >> T; for (i = 0; i < A; i++) cin >> X[i]; for (i = 0; i < B; i++) cin >> Y[i]; for (i = 0; i < T; i++) cin >> W[i] >> S[i]; cout << intputaway(A, B, T, X, Y, W, S); return 0; }*/

Compilation message (stderr)

robots.cpp:16:1: error: ISO C++ forbids declaration of 'intputaway' with no type [-fpermissive]
   16 | intputaway(int A, int B, int T, int X[], int Y[], int W[], int S[])
      | ^~~~~~~~~~