Submission #827689

#TimeUsernameProblemLanguageResultExecution timeMemory
827689VMaksimoski008Prisoner Challenge (IOI22_prison)C++17
Compilation error
0 ms0 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int> > devise_strategy(int n) { vector<vector<int> > ans(n+1, vector<int>(n+1)); for(int i=1; i<=n; i++) { ans[0][i] = i; ans[i][0] = 1; fill(ans.begin()+1, ans.begin()+i, -2); fill(ans.begin()+1+i, ans.end(), -1); } return ans; }

Compilation message (stderr)

In file included from /usr/include/c++/10/vector:60,
                 from prison.h:1,
                 from prison.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h: In instantiation of 'typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type std::__fill_a1(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = std::vector<int>*; _Tp = int; typename __gnu_cxx::__enable_if<std::__is_scalar<_Tp>::__value, void>::__type = void]':
/usr/include/c++/10/bits/stl_algobase.h:902:21:   required from 'void std::__fill_a1(__gnu_cxx::__normal_iterator<_Iterator, _Container>, __gnu_cxx::__normal_iterator<_Iterator, _Container>, const _Tp&) [with _Ite = std::vector<int>*; _Cont = std::vector<std::vector<int> >; _Tp = int]'
/usr/include/c++/10/bits/stl_algobase.h:914:21:   required from 'void std::__fill_a(_FIte, _FIte, const _Tp&) [with _FIte = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >; _Tp = int]'
/usr/include/c++/10/bits/stl_algobase.h:944:20:   required from 'void std::fill(_ForwardIterator, _ForwardIterator, const _Tp&) [with _ForwardIterator = __gnu_cxx::__normal_iterator<std::vector<int>*, std::vector<std::vector<int> > >; _Tp = int]'
prison.cpp:12:46:   required from here
/usr/include/c++/10/bits/stl_algobase.h:873:11: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'const int')
  873 |  *__first = __tmp;
      |  ~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/10/vector:72,
                 from prison.h:1,
                 from prison.cpp:1:
/usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from 'const int' to 'const std::vector<int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/10/vector:67,
                 from prison.h:1,
                 from prison.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from 'const int' to 'std::vector<int>&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from 'const int' to 'std::initializer_list<int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~