Submission #1269203

#TimeUsernameProblemLanguageResultExecution timeMemory
1269203jojeonghoon벽 칠하기 (APIO20_paint)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <cstdio> #include <cstdlib> #include <cassert> #include <vector> #include <map> #include <set> #define int long long using namespace std; const int LM=100100; int N,M,K; vector<int> C, A; vector<vector<int>>B, E; int D[LM], w[LM], ch[LM]; vector<int> pr; void F(int x, int color){ int d=0; for(int i:E[color]){ int t=(i-x+M+N)%M; ch[t]=1; d=max(++w[t], d); } D[x]=d; for(int i:pr) if(!ch[i]) w[i]=0; pr.clear(); for(int i:E[color]){ ch[i]=0; pr.push_back(i); } } signed minimumInstructions(signed N_, signed M_, signed K_, vector<signed> C_, vector<signed>A_, vector<vector<signed>>B_){ N=N_, M=M_, K=K_, C=C_, A=A_, B=B_; E.assign(K, {}); for(int i=0; i<M; i++){ for(int j=0; j<A[i]; j++){ E[B[i][j]].push_back(i); } } for(int i=0; i<N; i++){ F(i, C[i]); if(D[i]==0) return -1; } int k=0; for(int i=0; i<N; i++){ k++; if(D[i] >= D[i+1]){ if(D[i]<M) return -1; if(D[i+1] <= k%M){ k = (k+M-1)/M*M; } } } return (k+M-1)/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:37:25: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   37 |     N=N_, M=M_, K=K_, C=C_, A=A_, B=B_;
      |                         ^~
In file included from /usr/include/c++/13/vector:72,
                 from paint.cpp:5:
/usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/13/vector:66:
/usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
paint.cpp:37:31: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and 'std::vector<int>')
   37 |     N=N_, M=M_, K=K_, C=C_, A=A_, B=B_;
      |                               ^~
/usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
paint.cpp:37:37: error: no match for 'operator=' (operand types are 'std::vector<std::vector<long long int> >' and 'std::vector<std::vector<int> >')
   37 |     N=N_, M=M_, K=K_, C=C_, A=A_, B=B_;
      |                                     ^~
/usr/include/c++/13/bits/vector.tcc:210:5: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'const std::vector<std::vector<long long int> >&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:766:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::vector<std::vector<long long int> >&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:788:7: note: candidate: 'constexpr std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from 'std::vector<std::vector<int> >' to 'std::initializer_list<std::vector<long long int> >'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~