Submission #898247

#TimeUsernameProblemLanguageResultExecution timeMemory
898247irmuunPainting Walls (APIO20_paint)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "paint.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int minimumInstructions(int n,int m,int k,vector<int>C,vector<int>A,vector<vector<int>>B){ if(n%m>0){ return -1; } int s=0; for(int i=0;i<m;i++){ if(A[i][0]==C[0]){ s=i; break; } } bool ok=true; for(int i=0;i<n;i++){ if(C[i]!=A[s][0]){ ok=false; break; } s++; if(s==m) s-=m; } if(!ok) return -1; return n/m; }

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:19:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   19 |         if(A[i][0]==C[0]){
      |                ^
paint.cpp:26:22: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   26 |         if(C[i]!=A[s][0]){
      |                      ^