Submission #962802

#TimeUsernameProblemLanguageResultExecution timeMemory
962802n3rm1nRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include"robots.h" using namespace std; const int MAXN = 1e6 + 10; int a, b, t, x[MAXN], y[MAXN], s[MAXN], w[MAXN]; bool check(int xt) { int index = 0; for (int i = 0; i < a; ++ i) { if(index == t)return true; int put = 0; while(indx < t && put < xt && w[index] < x[i]) { index ++; put ++; } } return (index == t); } int putaway(int A,int B,int T, int X[],int Y[],int W[],int S[]) { /// 14p if(A + B == 2 && T == 2) { int fit00 = 0, fit01 = 0, fit10 = 0, fit11 = 0; if(A == 2) { if(W[0] < X[0])fit00 ++; if(W[1] < X[0])fit01 ++; if(W[0] < X[1])fit10 ++; if(W[1] < X[1])fit11 ++; } else if(B == 2) { if(S[0] < Y[0])fit00 ++; if(S[1] < Y[0])fit01 ++; if(S[0] < Y[1])fit10 ++; if(S[1] < Y[1])fit11 ++; } else { if(W[0] < X[0])fit00 ++; if(W[1] < X[0])fit01 ++; if(S[0] < Y[0])fit10 ++; if(S[1] < Y[0])fit11 ++; } if(!fit01 && !fit11)return -1; if(!fit00 && !fit10)return -1; if(fit01 && fit10)return 1; if(fit00 && fit11)return 1; return 2; } /// sort + make global sort(X, X+A); sort(W, W+T); for (int i = 0; i < T; ++ i) { s[i] = S[i]; w[i] = W[i]; } for (int i = 0; i < A; ++ i) x[i] = X[i]; for (int i = 0; i < B; ++ i) y[i] = Y[i]; a = A; b = B; t = T; if(B == 0) { if(X[A-1] <= W[T-1])return -1; int l = 1, r = t, mid = 0, ans = t; while(l <= r) { mid = (l + r)/2; if(check(mid)) { ans = mid; r = mid - 1; } else l = mid + 1; } return ans; } }

Compilation message (stderr)

robots.cpp: In function 'bool check(int)':
robots.cpp:13:15: error: 'indx' was not declared in this scope; did you mean 'index'?
   13 |         while(indx < t && put < xt && w[index] < x[i])
      |               ^~~~
      |               index
robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:89:1: warning: control reaches end of non-void function [-Wreturn-type]
   89 | }
      | ^