| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1295515 | michaeltaranik | Knapsack (NOI18_knapsack) | C++20 | Compilation error | 0 ms | 0 KiB |
#include <iostream>
#include <limits.h>
#include <vector>
#include <map>
using namespace std;
#define V 0
#define W 1
#define K 2
int solvedp(int goal, vector<array<int, 2>>& items, vector<vector<int>>& memo, int idx) {
if (goal < 0) return INT_MIN;
if (goal == 0 || idx >= items.size()) return 0;
if (memo[goal][idx] != -1) return memo[goal][idx];
int skip = solvedp(goal, items, memo, idx+1);
int take = solvedp(goal - items[idx][W], items, memo, idx+1);
if (take >= 0) {
take += items[idx][V];
}
int best = max(skip, take);
memo[goal][idx] = best;
return best;
}
void solve() {
int s, n;
cin >> s >> n;
vector<array<int, 3>> items(n);
for (int i = 0; i < n; ++i) {
cin >> items[i][0];
cin >> items[i][1];
cin >> items[i][2];
}
vector<array<int, 2>> tms;
for (auto itm: items) {
for (int i = 0; i < itm[K]; ++i) {
tms.push_back({itm[V], itm[W]});
}
}
vector<vector<int>> memo(s+1, vector<int>(tms.size(), -1));
cout << solvedp(s, tms, memo, 0) << endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}
Compilation message (stderr)
knapsack.cpp: In function 'int solvedp(int, std::vector<std::array<int, 2> >&, std::vector<std::vector<int> >&, int)':
knapsack.cpp:17:41: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 2> >, std::array<int, 2> >::value_type' {aka 'std::array<int, 2>'} and 'int')
17 | int take = solvedp(goal - items[idx][W], items, memo, idx+1);
| ^
knapsack.cpp:19:27: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 2> >, std::array<int, 2> >::value_type' {aka 'std::array<int, 2>'} and 'int')
19 | take += items[idx][V];
| ^
knapsack.cpp: In function 'void solve()':
knapsack.cpp:33:24: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type' {aka 'std::array<int, 3>'} and 'int')
33 | cin >> items[i][0];
| ^
knapsack.cpp:34:24: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type' {aka 'std::array<int, 3>'} and 'int')
34 | cin >> items[i][1];
| ^
knapsack.cpp:35:24: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::array<int, 3> >, std::array<int, 3> >::value_type' {aka 'std::array<int, 3>'} and 'int')
35 | cin >> items[i][2];
| ^
knapsack.cpp:38:15: error: deduced type 'std::array<int, 3>' for 'itm' is incomplete
38 | for (auto itm: items) {
| ^~~
In file included from /usr/include/c++/13/bits/uses_allocator_args.h:38,
from /usr/include/c++/13/bits/memory_resource.h:41,
from /usr/include/c++/13/string:58,
from /usr/include/c++/13/bits/locale_classes.h:40,
from /usr/include/c++/13/bits/ios_base.h:41,
from /usr/include/c++/13/ios:44,
from /usr/include/c++/13/ostream:40,
from /usr/include/c++/13/iostream:41,
from knapsack.cpp:1:
/usr/include/c++/13/tuple:2019:45: note: declaration of 'struct std::array<int, 3>'
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
knapsack.cpp:40:26: error: no matching function for call to 'std::vector<std::array<int, 2> >::push_back(<brace-enclosed initializer list>)'
40 | tms.push_back({itm[V], itm[W]});
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/vector:66,
from knapsack.cpp:3:
/usr/include/c++/13/bits/stl_vector.h:1281:7: note: candidate: 'constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; value_type = std::array<int, 2>]'
1281 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1281:35: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::array<int, 2> >::value_type&' {aka 'const std::array<int, 2>&'}
1281 | push_back(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/13/bits/stl_vector.h:1298:7: note: candidate: 'constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; value_type = std::array<int, 2>]'
1298 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1298:30: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::array<int, 2> >::value_type&&' {aka 'std::array<int, 2>&&'}
1298 | push_back(value_type&& __x)
| ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/13/string:48:
/usr/include/c++/13/bits/stl_iterator.h: In instantiation of 'constexpr __gnu_cxx::__normal_iterator<_Iterator, _Container>& __gnu_cxx::__normal_iterator<_Iterator, _Container>::operator++() [with _Iterator = std::array<int, 3>*; _Container = std::vector<std::array<int, 3> >]':
knapsack.cpp:38:20: required from here
/usr/include/c++/13/bits/stl_iterator.h:1111:11: error: cannot increment a pointer to incomplete type 'std::array<int, 3>'
1111 | ++_M_current;
| ^~~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h: In instantiation of 'constexpr std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; size_type = long unsigned int]':
knapsack.cpp:43:55: required from here
/usr/include/c++/13/bits/stl_vector.h:993:50: error: invalid use of incomplete type 'struct std::array<int, 2>'
993 | { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'struct std::array<int, 2>'
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
/usr/include/c++/13/bits/stl_vector.h: In instantiation of 'constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; reference = std::array<int, 2>&; size_type = long unsigned int]':
knapsack.cpp:17:40: required from here
/usr/include/c++/13/bits/stl_vector.h:1129:41: error: invalid use of incomplete type 'struct std::array<int, 2>'
1129 | return *(this->_M_impl._M_start + __n);
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'struct std::array<int, 2>'
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
/usr/include/c++/13/bits/stl_vector.h: In instantiation of 'constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; reference = std::array<int, 3>&; size_type = long unsigned int]':
knapsack.cpp:33:23: required from here
/usr/include/c++/13/bits/stl_vector.h:1129:41: error: invalid use of incomplete type 'struct std::array<int, 3>'
1129 | return *(this->_M_impl._M_start + __n);
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'struct std::array<int, 3>'
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
/usr/include/c++/13/bits/stl_vector.h: In instantiation of 'constexpr std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >]':
/usr/include/c++/13/bits/stl_vector.h:531:7: required from here
/usr/include/c++/13/bits/stl_vector.h:370:49: error: invalid use of incomplete type 'struct std::array<int, 2>'
370 | _M_impl._M_end_of_storage - _M_impl._M_start);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'struct std::array<int, 2>'
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
/usr/include/c++/13/bits/stl_vector.h: In instantiation of 'constexpr std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]':
/usr/include/c++/13/bits/stl_vector.h:557:47: required from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/bits/stl_vector.h:370:49: error: invalid use of incomplete type 'struct std::array<int, 3>'
370 | _M_impl._M_end_of_storage - _M_impl._M_start);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'struct std::array<int, 3>'
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
/usr/include/c++/13/bits/stl_vector.h: In instantiation of 'static constexpr std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::_S_max_size(const _Tp_alloc_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; _Tp_alloc_type = std::vector<std::array<int, 3> >::_Tp_alloc_type]':
/usr/include/c++/13/bits/stl_vector.h:1909:23: required from 'static constexpr std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::_S_check_init_len(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
/usr/include/c++/13/bits/stl_vector.h:557:32: required from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/bits/stl_vector.h:1922:61: error: invalid application of 'sizeof' to incomplete type 'std::array<int, 3>'
1922 | = __gnu_cxx::__numeric_traits<ptrdiff_t>::__max / sizeof(_Tp);
| ^~~~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h: In instantiation of 'constexpr void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; std::size_t = long unsigned int]':
/usr/include/c++/13/bits/stl_vector.h:335:9: required from 'constexpr std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; std::size_t = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
/usr/include/c++/13/bits/stl_vector.h:557:47: required from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/bits/stl_vector.h:400:66: error: invalid use of incomplete type 'struct std::array<int, 3>'
400 | this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'struct std::array<int, 3>'
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
In file included from /usr/include/c++/13/bits/move.h:37,
from /usr/include/c++/13/bits/exception_ptr.h:41,
from /usr/include/c++/13/exception:164,
from /usr/include/c++/13/ios:41:
/usr/include/c++/13/type_traits: In instantiation of 'struct std::is_destructible<std::array<int, 3> >':
/usr/include/c++/13/bits/stl_construct.h:188:51: required from 'constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = array<int, 3>*]'
/usr/include/c++/13/bits/alloc_traits.h:948:20: required from 'constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = array<int, 3>*; _Tp = array<int, 3>]'
/usr/include/c++/13/bits/stl_vector.h:735:15: required from 'constexpr std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/type_traits:979:52: error: static assertion failed: template argument must be a complete class or an unbounded array
979 | static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/type_traits:979:52: note: 'std::__is_complete_or_unbounded<__type_identity<array<int, 3> > >((std::__type_identity<std::array<int, 3> >(), std::__type_identity<std::array<int, 3> >()))' evaluates to false
In file included from /usr/include/c++/13/bits/char_traits.h:57,
from /usr/include/c++/13/ios:42:
/usr/include/c++/13/bits/stl_construct.h: In instantiation of 'constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = array<int, 3>*]':
/usr/include/c++/13/bits/alloc_traits.h:948:20: required from 'constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = array<int, 3>*; _Tp = array<int, 3>]'
/usr/include/c++/13/bits/stl_vector.h:735:15: required from 'constexpr std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/bits/stl_construct.h:188:51: error: static assertion failed: value type is destructible
188 | static_assert(is_destructible<_Value_type>::value,
| ^~~~~
/usr/include/c++/13/bits/stl_construct.h:188:51: note: 'std::integral_constant<bool, false>::value' evaluates to false
/usr/include/c++/13/bits/stl_construct.h:195:25: error: invalid use of incomplete type 'using std::iterator_traits<std::array<int, 3>*>::value_type = std::remove_cv_t<std::array<int, 3> >' {aka 'struct std::array<int, 3>'} [-fpermissive]
195 | std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'using std::iterator_traits<std::array<int, 3>*>::value_type = std::remove_cv_t<std::array<int, 3> >' {aka 'struct std::array<int, 3>'}
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
/usr/include/c++/13/type_traits: In instantiation of 'struct std::is_destructible<std::array<int, 2> >':
/usr/include/c++/13/bits/stl_construct.h:188:51: required from 'constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = array<int, 2>*]'
/usr/include/c++/13/bits/alloc_traits.h:948:20: required from 'constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = array<int, 2>*; _Tp = array<int, 2>]'
/usr/include/c++/13/bits/stl_vector.h:735:15: required from 'constexpr std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >]'
knapsack.cpp:37:27: required from here
/usr/include/c++/13/type_traits:979:52: error: static assertion failed: template argument must be a complete class or an unbounded array
979 | static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/type_traits:979:52: note: 'std::__is_complete_or_unbounded<__type_identity<array<int, 2> > >((std::__type_identity<std::array<int, 2> >(), std::__type_identity<std::array<int, 2> >()))' evaluates to false
/usr/include/c++/13/bits/stl_construct.h: In instantiation of 'constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator) [with _ForwardIterator = array<int, 2>*]':
/usr/include/c++/13/bits/alloc_traits.h:948:20: required from 'constexpr void std::_Destroy(_ForwardIterator, _ForwardIterator, allocator<_T2>&) [with _ForwardIterator = array<int, 2>*; _Tp = array<int, 2>]'
/usr/include/c++/13/bits/stl_vector.h:735:15: required from 'constexpr std::vector<_Tp, _Alloc>::~vector() [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >]'
knapsack.cpp:37:27: required from here
/usr/include/c++/13/bits/stl_construct.h:188:51: error: static assertion failed: value type is destructible
188 | static_assert(is_destructible<_Value_type>::value,
| ^~~~~
/usr/include/c++/13/bits/stl_construct.h:188:51: note: 'std::integral_constant<bool, false>::value' evaluates to false
/usr/include/c++/13/bits/stl_construct.h:195:25: error: invalid use of incomplete type 'using std::iterator_traits<std::array<int, 2>*>::value_type = std::remove_cv_t<std::array<int, 2> >' {aka 'struct std::array<int, 2>'} [-fpermissive]
195 | std::_Destroy_aux<__has_trivial_destructor(_Value_type)>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'using std::iterator_traits<std::array<int, 2>*>::value_type = std::remove_cv_t<std::array<int, 2> >' {aka 'struct std::array<int, 2>'}
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
/usr/include/c++/13/type_traits: In instantiation of 'struct std::is_copy_assignable<std::array<int, 3> >':
/usr/include/c++/13/type_traits:161:35: required by substitution of 'template<class ... _Bn> std::__detail::__first_t<std::integral_constant<bool, true>, typename std::enable_if<(bool)(_Bn::value), void>::type ...> std::__detail::__and_fn(int) [with _Bn = {std::is_integral<long unsigned int>, std::is_copy_assignable<std::array<int, 3> >}]'
/usr/include/c++/13/type_traits:177:42: required from 'struct std::__and_<std::is_integral<long unsigned int>, std::is_copy_assignable<std::array<int, 3> > >'
/usr/include/c++/13/bits/stl_uninitialized.h:708:64: required from 'constexpr _ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = array<int, 3>*; _Size = long unsigned int]'
/usr/include/c++/13/bits/stl_uninitialized.h:779:44: required from 'constexpr _ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = array<int, 3>*; _Size = long unsigned int; _Tp = array<int, 3>]'
/usr/include/c++/13/bits/stl_vector.h:1718:36: required from 'constexpr void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:558:9: required from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/type_traits:1167:52: error: static assertion failed: template argument must be a complete class or an unbounded array
1167 | static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/type_traits:1167:52: note: 'std::__is_complete_or_unbounded<__type_identity<array<int, 3> > >((std::__type_identity<std::array<int, 3> >(), std::__type_identity<std::array<int, 3> >()))' evaluates to false
In file included from /usr/include/c++/13/vector:65:
/usr/include/c++/13/bits/stl_uninitialized.h: In instantiation of 'constexpr _ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = array<int, 3>*; _Size = long unsigned int]':
/usr/include/c++/13/bits/stl_uninitialized.h:779:44: required from 'constexpr _ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = array<int, 3>*; _Size = long unsigned int; _Tp = array<int, 3>]'
/usr/include/c++/13/bits/stl_vector.h:1718:36: required from 'constexpr void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:558:9: required from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/bits/stl_uninitialized.h:710:42: error: invalid use of incomplete type 'using std::iterator_traits<std::array<int, 3>*>::value_type = std::remove_cv_t<std::array<int, 3> >' {aka 'struct std::array<int, 3>'} [-fpermissive]
710 | return __uninitialized_default_n_1<__is_trivial(_ValueType)
| ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/tuple:2019:45: note: declaration of 'using std::iterator_traits<std::array<int, 3>*>::value_type = std::remove_cv_t<std::array<int, 3> >' {aka 'struct std::array<int, 3>'}
2019 | template<typename _Tp, size_t _Nm> struct array;
| ^~~~~
/usr/include/c++/13/bits/stl_uninitialized.h: In instantiation of 'static constexpr _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = std::array<int, 3>*; _Size = long unsigned int; bool _TrivialValueType = false]':
/usr/include/c++/13/bits/stl_uninitialized.h:701:22: required from 'constexpr _ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = array<int, 3>*; _Size = long unsigned int]'
/usr/include/c++/13/bits/stl_uninitialized.h:779:44: required from 'constexpr _ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = array<int, 3>*; _Size = long unsigned int; _Tp = array<int, 3>]'
/usr/include/c++/13/bits/stl_vector.h:1718:36: required from 'constexpr void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:558:9: required from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/bits/stl_uninitialized.h:642:47: error: cannot increment a pointer to incomplete type 'std::array<int, 3>'
642 | for (; __n > 0; --__n, (void) ++__cur)
| ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/c++allocator.h:33,
from /usr/include/c++/13/bits/allocator.h:46,
from /usr/include/c++/13/string:43:
/usr/include/c++/13/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = std::array<int, 2>; size_type = long unsigned int]':
/usr/include/c++/13/bits/allocator.h:210:35: required from 'constexpr void std::allocator< <template-parameter-1-1> >::deallocate(_Tp*, std::size_t) [with _Tp = std::array<int, 2>; std::size_t = long unsigned int]'
/usr/include/c++/13/bits/alloc_traits.h:517:23: required from 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::deallocate(allocator_type&, pointer, size_type) [with _Tp = std::array<int, 2>; allocator_type = std::allocator<std::array<int, 2> >; pointer = std::array<int, 2>*; size_type = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:390:19: required from 'constexpr void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >; pointer = std::array<int, 2>*; std::size_t = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:369:2: required from 'constexpr std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<int, 2>; _Alloc = std::allocator<std::array<int, 2> >]'
/usr/include/c++/13/bits/stl_vector.h:531:7: required from here
/usr/include/c++/13/bits/new_allocator.h:165:13: error: invalid application of '__alignof__' to incomplete type 'std::array<int, 2>'
165 | if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
| ^~~~~~~~~~~~
/usr/include/c++/13/bits/new_allocator.h:167:38: error: invalid application of 'sizeof' to incomplete type 'std::array<int, 2>'
167 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n),
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/new_allocator.h:168:55: error: invalid application of '__alignof__' to incomplete type 'std::array<int, 2>'
168 | std::align_val_t(alignof(_Tp)));
| ^~~~~~~~~~~~
/usr/include/c++/13/bits/new_allocator.h:172:34: error: invalid application of 'sizeof' to incomplete type 'std::array<int, 2>'
172 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/allocator.h: In instantiation of 'constexpr _Tp* std::allocator< <template-parameter-1-1> >::allocate(std::size_t) [with _Tp = std::array<int, 3>; std::size_t = long unsigned int]':
/usr/include/c++/13/bits/alloc_traits.h:482:28: required from 'static constexpr _Tp* std::allocator_traits<std::allocator<_CharT> >::allocate(allocator_type&, size_type) [with _Tp = std::array<int, 3>; pointer = std::array<int, 3>*; allocator_type = std::allocator<std::array<int, 3> >; size_type = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:381:33: required from 'constexpr std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; pointer = std::array<int, 3>*; std::size_t = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:398:33: required from 'constexpr void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; std::size_t = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:335:9: required from 'constexpr std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; std::size_t = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
/usr/include/c++/13/bits/stl_vector.h:557:47: required from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/bits/allocator.h:193:45: error: invalid application of 'sizeof' to incomplete type 'std::array<int, 3>'
193 | if (__builtin_mul_overflow(__n, sizeof(_Tp), &__n))
| ^~~~~~~~~~~
/usr/include/c++/13/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = std::array<int, 3>; size_type = long unsigned int]':
/usr/include/c++/13/bits/allocator.h:210:35: required from 'constexpr void std::allocator< <template-parameter-1-1> >::deallocate(_Tp*, std::size_t) [with _Tp = std::array<int, 3>; std::size_t = long unsigned int]'
/usr/include/c++/13/bits/alloc_traits.h:517:23: required from 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::deallocate(allocator_type&, pointer, size_type) [with _Tp = std::array<int, 3>; allocator_type = std::allocator<std::array<int, 3> >; pointer = std::array<int, 3>*; size_type = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:390:19: required from 'constexpr void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; pointer = std::array<int, 3>*; std::size_t = long unsigned int]'
/usr/include/c++/13/bits/stl_vector.h:369:2: required from 'constexpr std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >]'
/usr/include/c++/13/bits/stl_vector.h:557:47: required from 'constexpr std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; size_type = long unsigned int; allocator_type = std::allocator<std::array<int, 3> >]'
knapsack.cpp:30:34: required from here
/usr/include/c++/13/bits/new_allocator.h:165:13: error: invalid application of '__alignof__' to incomplete type 'std::array<int, 3>'
165 | if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
| ^~~~~~~~~~~~
/usr/include/c++/13/bits/new_allocator.h:167:38: error: invalid application of 'sizeof' to incomplete type 'std::array<int, 3>'
167 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n),
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/new_allocator.h:168:55: error: invalid application of '__alignof__' to incomplete type 'std::array<int, 3>'
168 | std::align_val_t(alignof(_Tp)));
| ^~~~~~~~~~~~
/usr/include/c++/13/bits/new_allocator.h:172:34: error: invalid application of 'sizeof' to incomplete type 'std::array<int, 3>'
172 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
| ^~~~~~~~~~~~~~~~~~~~~~