Submission #550866

#TimeUsernameProblemLanguageResultExecution timeMemory
550866David_MRobots (IOI13_robots)C++14
Compilation error
0 ms0 KiB
#include "robots.h" #include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define pb push_back int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { int ans=-1; vector<array<int, 3>> p(T); for (int i=0; i<T; i++)p[i]={W[i], S[i], i},v.insert({S[i],i}); sort(all(p));sort(X, X+A);sort(Y, Y+B); int l=1, r=T+1; while(l<=r){ int m=l+r>>1; int M=0, k=0; vector<bool> f(T,0); set<array<int, 2>> v; priority_queue<array<int, 2>> s; for (int e=0; e<A; e++){int x=X[e];M=m; while(k<T && x>p[k][0]) s.push({p[k][1],p[k][2]}), k++; while(!s.empty() && M--) v.erase(s.top()), s.pop(); } for (int e=0; e<B; e++){int y=Y[e];M=m; while(v.size() && M-- && y>(*v.begin())[0]) v.erase(v.begin()); } if(v.size())l=m+1; else ans=m, r=m-1; } return ans; }

Compilation message (stderr)

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:10:49: error: 'v' was not declared in this scope
   10 |     for (int i=0; i<T; i++)p[i]={W[i], S[i], i},v.insert({S[i],i});
      |                                                 ^
robots.cpp:15:16: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   15 |         int m=l+r>>1;
      |               ~^~