Submission #409648

#TimeUsernameProblemLanguageResultExecution timeMemory
409648enerelt14Painting Walls (APIO20_paint)C++14
Compilation error
0 ms0 KiB
#include "paint.h" #include<bits/stdc++.h> #include <vector> bool is[205][100005]; int minimumInstructions( int N, int M, int K, std::vector<int> C, std::vector<int> A, std::vector<std::vector<int>> B) { bool ps[505]; memset(ps, 0, sizeof(ps)); memset(pos, 0, sizeof(pos)); memset(is, 0, sizeof(is)); for (int i=0;i<M;i++)for (int j=0;j<A[i];j++)is[i][B[i][j]]=1; for (int i=0;i<N-M;i++){ for (int j=0;j<M;j++){ if (ps[i])break; if (is[j][C[i]]){ bool x=0; for (int l=0;l<M;l++){ if (!is[(j+l)%M][C[i+l]]){ x=1; break; } } if (!x)ps[i]=1; } } } int res=1, t=N-M; if (!ps[t])return -1; while(t!=0){ bool q=0; for (int i=t-m;i<t;i++){ if (pos[i]){ t=i; q=1; res++; break; } } if (!q)return -1; } return res; }

Compilation message (stderr)

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:10:13: error: 'pos' was not declared in this scope; did you mean 'ps'?
   10 |      memset(pos, 0, sizeof(pos));
      |             ^~~
      |             ps
paint.cpp:32:17: error: 'm' was not declared in this scope
   32 |    for (int i=t-m;i<t;i++){
      |                 ^