제출 #395826

#제출 시각아이디문제언어결과실행 시간메모리
395826khangal벽 칠하기 (APIO20_paint)C++14
컴파일 에러
0 ms0 KiB
#include "paint.h" #include<bits/stdc++.h> using namespace std; typedef int ll; typedef pair<ll,ll> pl; #define pb push_back #define ff first #define ss second // typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; // template< typename T> // using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; ll n,m,mid,mn,T,sum,c[1234567],h1,h2,x,y,z,l,r,cnt,cnt1,ans; vector<ll> vec[1234567]; bool ok[1234567],ok1; int minimumInstructions( int N, int M, int K, std::vector<int> C, std::vector<int> A, std::vector<std::vector<int>> B) { for(int i=0;i<M;i++){ for(auto u:B[i]) vec[u].pb(i); } vector<vector<ll> > mp(M)(); for(int i=0;i<N;i++){ for(auto u:vec[C[i]]){ mp[((u-i)%M+M)%M].pb(i); } } vl v(N); for(auto u:mp){ ll last = N+1; ll len =0; for(int i=u.size()-1;i>=0;i--){ if(u[i]+1!=last)last=0; last++; v[u[i]]=max(v[u[i]],len); last=u[i]; } } vl ok; for(int i=0;i<N;i++)if(v[i]>=M)ok.pb(i); ll Rpoint=0; ll id=0; while(Rpoint<N){ while(id<ok.size()&&ok[id]<=Rpoint){ id++; } if(id==0)return -1; ll Lpoint = ok[id-1]; if(Lpoint + M < Rpoint)return -1; ans++; } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:21:27: error: expected ',' or ';' before '(' token
   21 |  vector<vector<ll> > mp(M)();
      |                           ^
paint.cpp:27:2: error: 'vl' was not declared in this scope; did you mean 'l'?
   27 |  vl v(N);
      |  ^~
      |  l
paint.cpp:34:4: error: 'v' was not declared in this scope
   34 |    v[u[i]]=max(v[u[i]],len);
      |    ^
paint.cpp:38:4: error: expected ';' before 'ok'
   38 |  vl ok;
      |    ^~~
      |    ;
paint.cpp:39:25: error: 'v' was not declared in this scope
   39 |  for(int i=0;i<N;i++)if(v[i]>=M)ok.pb(i);
      |                         ^
paint.cpp:6:12: error: request for member 'push_back' in 'ok', which is of non-class type 'bool [1234567]'
    6 | #define pb push_back
      |            ^~~~~~~~~
paint.cpp:39:36: note: in expansion of macro 'pb'
   39 |  for(int i=0;i<N;i++)if(v[i]>=M)ok.pb(i);
      |                                    ^~
paint.cpp:43:15: error: request for member 'size' in 'ok', which is of non-class type 'bool [1234567]'
   43 |   while(id<ok.size()&&ok[id]<=Rpoint){
      |               ^~~~